Converting Image to Sketch with Python
Image to Sketch
import cv2
image = cv2.imread(r"D:\image.jpg")
grey_img = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
invert = cv2.bitwise_not(grey_img)
blur = cv2.GaussianBlur(invert, (31, 91), 20)
invert_blur = cv2.bitwise_not(blur)
sketch = cv2.divide(grey_img, invert_blur, scale=290.0)
cv2.imwrite("my_sketch.png", sketch)
Post a Comment