forked from sourabhjagtap95/AwesomePythonScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebcamshot.py
More file actions
41 lines (25 loc) · 639 Bytes
/
Copy pathwebcamshot.py
File metadata and controls
41 lines (25 loc) · 639 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
41
#Take photo from webcam at entered time interval in seconds
#OpeCV2 required
import cv2
import time
camera_port = 0
#set camera port. Default camera is 0
camera = cv2.VideoCapture(camera_port)
def get_image():
retval, im = camera.read()
return im
# time interval for each photo
print "Press CTRL+C to stop"
print "Enter time interval for each shot:"
t=int(raw_input())
i=0
temp = get_image()
while(True):
camera_capture = get_image()
fil ="webshot",str(i),".png"
print"saving webcam shot",str(i)
file=''.join(fil)
cv2.imwrite(file, camera_capture)
time.sleep(t)
i=i+1
del(camera)