Skip to content

Commit ca74e3a

Browse files
authored
Add files via upload
1 parent 6d2bde2 commit ca74e3a

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

pencil sketcher/image1.jpg

72 KB
Loading

pencil sketcher/output.png

430 KB
Loading

pencil sketcher/sketcher.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import cv2
2+
3+
# Load the image
4+
image = cv2.imread('image1.jpg')
5+
6+
# Convert to gray scale
7+
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
8+
9+
# Invert the grayscale image
10+
inverted = 255 - gray
11+
12+
# Apply Gaussian blur
13+
blurred = cv2.GaussianBlur(inverted, (21, 21), 0)
14+
15+
# Invert the blurred image
16+
inverted_blur = 255 - blurred
17+
18+
# Create the pencil sketch
19+
sketch = cv2.divide(gray, inverted_blur, scale=256.0)
20+
21+
# Show the result
22+
cv2.imshow("Original", image)
23+
cv2.imshow("Pencil Sketch", sketch)
24+
cv2.waitKey(0)
25+
cv2.destroyAllWindows()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy