mirror of
https://github.com/BKHMSI/Sketchback.git
synced 2024-10-26 23:28:39 +03:00
19 lines
550 B
Python
19 lines
550 B
Python
|
import cv2 as cv
|
||
|
import numpy as np
|
||
|
import os
|
||
|
from filters import PencilSketch
|
||
|
|
||
|
|
||
|
for file in os.listdir('ZuBuD'):
|
||
|
file_path = os.path.join('ZuBuD', file)
|
||
|
img = cv.imread(file_path)
|
||
|
img = cv.cvtColor(img, cv.COLOR_BGR2RGB)
|
||
|
print (img.shape)
|
||
|
height, width, channels = img.shape
|
||
|
if (height, width, channels) == (240,320,3):
|
||
|
img = np.resize(img, (480, 640, 3))
|
||
|
pencil = PencilSketch(width, height)
|
||
|
sketch = pencil.render(img)
|
||
|
write_path = os.path.join('ZuBuD_Sketch', file)
|
||
|
cv.imwrite(write_path, sketch)
|
||
|
|