Exemplo n.º 1
0
 def _init_custom_layout(self):
     """Initializes image filter effects"""
     self.pencil_sketch = PencilSketch((self.imgWidth, self.imgHeight))
     self.warm_filter = WarmingFilter()
     self.cool_filter = CoolingFilter()
     self.cartoonizer = Cartoonizer()
Exemplo n.º 2
0
import cv2 as cv
import numpy as np
import os
from filters import PencilSketch

m = 240
n = 320
DIR_PATH = 'ZuBuD'
SKETCH_PATH = 'ZuBuD_Sketch'

for file in os.listdir(DIR_PATH):
    file_path = os.path.join(DIR_PATH, file)
    img = cv.imread(file_path)
    img = cv.cvtColor(img, cv.COLOR_BGR2RGB)
    height, width, channels = img.shape
    if (height, width, channels) != (m, n, 3):
        img = np.resize(img, (m, n, 3))
    pencil = PencilSketch(width, height)
    sketch = pencil.render(img)
    write_path = os.path.join(SKETCH_PATH, file)
    cv.imwrite(write_path, sketch)