-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCapture.py
More file actions
40 lines (26 loc) · 753 Bytes
/
Capture.py
File metadata and controls
40 lines (26 loc) · 753 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
34
35
36
37
38
39
40
"""
Created on Sun Nov 29 16:16:28 2020
@author: Guney Doruk
"""
import cv2
directory = r'C:\Captured images'
video_capture = cv2.VideoCapture(0)
success = video_capture.isOpened()
if(success == False):
video_capture.open(0)
success = True
i = 0
fps = video_capture.get(cv2.CAP_PROP_FPS)
print(fps)
while success:
ret, frame = video_capture.read()
cv2.imshow('frame', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
if cv2.waitKey(100) & 0xFF == ord('f'):
name = "\deneme_"+str(i)+ ".jpeg"
path = directory + name
cv2.imwrite(path,frame)
i += 1
video_capture.release()
cv2.destroyAllWindows()