mirror of
https://github.com/metafy-social/python-scripts.git
synced 2025-01-18 07:17:03 +00:00
Added Python script to convert Pictures into Sketch
This commit is contained in:
parent
4eda20bccd
commit
73988dcf78
10
scripts/Pictures into Sketch/README.md
Normal file
10
scripts/Pictures into Sketch/README.md
Normal 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>
|
||||
```
|
11
scripts/Pictures into Sketch/main.py
Normal file
11
scripts/Pictures into Sketch/main.py
Normal 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)
|
Loading…
Reference in New Issue
Block a user