-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
33 lines (23 loc) · 712 Bytes
/
test.py
File metadata and controls
33 lines (23 loc) · 712 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import cv2
import scripts
def main():
source = scripts.get_video_source()
cap = cv2.VideoCapture(source)
if not cap.isOpened():
print("couldn't open camera")
return
while True:
ret, frame = cap.read()
if not ret:
print("Can't read frame. Video or camera feed may have ended.")
break
# blur with Gaussian blur kernel
blurred_frame = cv2.GaussianBlur(frame, (25,25), 0)
cv2.imshow('camera feed', frame)
cv2.imshow('blurred frame', blurred_frame)
# PRESS Q TO EXIT
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
main()