Added Python script to convert Pictures into Sketch

This commit is contained in:
Aditya 2022-10-18 01:49:29 +05:30
parent 4eda20bccd
commit 73988dcf78
2 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,10 @@
This is a simple Python script to convert Pictures into Sketch
## Usage
```bash
# install xlwt
pip install requests
# run script
python main.py <POST_ID>
```

View File

@ -0,0 +1,11 @@
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)