Skip to content

Commit 2b8509a

Browse files
Merge pull request #403 from sharma-kunal/master
Created a new file live_sketch.py
2 parents 7838ef3 + 622f7c9 commit 2b8509a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

live_sketch.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import cv2
2+
import numpy as np
3+
4+
def sketch(image):
5+
6+
img_gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
7+
img_gray_blur = cv2.GaussianBlur(img_gray, (5,5), 0)
8+
canny_edges = cv2.Canny(img_gray_blur, 10, 70)
9+
ret, mask = cv2.threshold(canny_edges, 70, 255, cv2.THRESH_BINARY_INV)
10+
return mask
11+
12+
cap = cv2.VideoCapture(0)
13+
14+
while True:
15+
ret, frame = cap.read()
16+
cv2.imshow('Our Live Sketcher', sketch(frame))
17+
if cv2.waitKey(1) == 13:
18+
break
19+
20+
cap.release()
21+
cv2.destroyAllWindows()

0 commit comments

Comments
 (0)