From 09fc7635e4c69c16225bbaf39d962d566c64f070 Mon Sep 17 00:00:00 2001 From: adityahacker109251 <112795187+adityahacker109251@users.noreply.github.com> Date: Tue, 18 Oct 2022 19:20:12 +0530 Subject: [PATCH] Create Picture into sketch.py --- Picture into sketch.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Picture into sketch.py diff --git a/Picture into sketch.py b/Picture into sketch.py new file mode 100644 index 0000000..aafbabd --- /dev/null +++ b/Picture into sketch.py @@ -0,0 +1,12 @@ +# using this program you can convert any of your picture into sketch. +from turtle import done +import cv2 +img = input("Enter the name of image with file extension name that is in the same directory") +image = cv2.imread(img) +grey_img = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) +invert = cv2.bitwise_not(grey_img) +blur = cv2.GaussianBlur(invert, (21,21),0) +invertedblur = cv2.bitwise_not(blur) +sketch = cv2.divide(grey_img, invertedblur, scale=256.0) + +cv2.imwrite("sketch.png", sketch)