-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathworkflow.py
39 lines (31 loc) · 880 Bytes
/
workflow.py
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
import time
import datetime
import cv2
from PIL import ImageGrab
import winsound
#cam = cv2.VideoCapture(0)
winName = "Movement Indicator"
#cv2.namedWindow(winName, cv2.CV_WINDOW_AUTOSIZE)
bildNr = 0
cam = cv2.VideoCapture(0)
while True:
#cv2.destroyWindow(winName)
#cv2.imshow(winName,cam.read()[1])
key = cv2.waitKey(10)
if key == 27:
cv2.destroyWindow(winName)
break
time.sleep(2)
ts = time.time()
nowTime = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d_%H-%M-%S')
im = ImageGrab.grab()
# Tkinter.Tk().bell()
winsound.PlaySound('koko.wav', winsound.SND_FILENAME)
im.save('workflow/screenshot_'+str(nowTime)+'.png')
cv2.imwrite('workflow/'+'you_'+str(nowTime)+'.jpg',cam.read()[1])
time.sleep(2)
bildNr += 1
print 'snap'+str(bildNr)
time.sleep(60*10)
cam.release()
print "Goodbye"