mirror of
https://github.com/metafy-social/python-scripts.git
synced 2025-01-18 15:27:07 +00:00
Added a script which generates sketch
This commit is contained in:
parent
7c26df7219
commit
bdafcd22e2
BIN
scripts/Img to Sketch/demo.jpg
Normal file
BIN
scripts/Img to Sketch/demo.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 206 KiB |
12
scripts/Img to Sketch/img-sketch.py
Normal file
12
scripts/Img to Sketch/img-sketch.py
Normal 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)
|
||||
|
16
scripts/Img to Sketch/readme.md
Normal file
16
scripts/Img to Sketch/readme.md
Normal 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`
|
2
scripts/Img to Sketch/requirements.txt
Normal file
2
scripts/Img to Sketch/requirements.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
numpy==1.23.4
|
||||
opencv-python==4.6.0.66
|
BIN
scripts/Img to Sketch/sketch.png
Normal file
BIN
scripts/Img to Sketch/sketch.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 421 KiB |
Loading…
Reference in New Issue
Block a user