Added a script which generates sketch

This commit is contained in:
unknown 2022-10-15 15:27:10 +05:30
parent 7c26df7219
commit bdafcd22e2
5 changed files with 30 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

View File

@ -0,0 +1,12 @@
import cv2
img = cv2.imread('demo.jpg') # enter your image here
grey_img = cv2.cvtColor(img, 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)

View File

@ -0,0 +1,16 @@
### Script to generate sketch
This is a simple python script which uses cv2 to generate sketch out of an image
[input image](demo.jpg)
[output image](sketch.png)
<br/>
#### Get started
`pip install -r requirements.txt`
#### Thats it!
`python img-sketch.py`

View File

@ -0,0 +1,2 @@
numpy==1.23.4
opencv-python==4.6.0.66

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 KiB