Skip to content

Pencilsketch app #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.vscode/extensions.json
SudokuSolver/__pycache__/sudoku.cpython-38.pyc
.idea
pencilSketch/venv/
20 changes: 20 additions & 0 deletions pencilSketch/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import cv2

#reading image
image = cv2.imread("res/girl3.jpg")

#converting BGR image to grayscale
#cvtColor -> https://docs.opencv.org/3.4/d8/d01/group__imgproc__color__conversions.html#ga397ae87e1288a81d2363b61574eb8cab
gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

#image invert
inverted_image = 255 - gray_image

#blurring image
#GaussianBlur -> https://docs.opencv.org/master/d4/d86/group__imgproc__filter.html#gaabe8c836e97159a9193fb0b11ac52cf1
blurred_image = cv2.GaussianBlur(gray_image, (43, 43), 0)
pencil_sketch = cv2.divide(gray_image, blurred_image, scale=250.0)

cv2.imshow("Original Image", image)
cv2.imshow("Pencil Sketch", pencil_sketch)
cv2.waitKey(0)
Binary file added pencilSketch/res/girl3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.