YACWC
This commit is contained in:
37
takeSnapshot.py
Executable file
37
takeSnapshot.py
Executable file
@@ -0,0 +1,37 @@
|
||||
import os
|
||||
from datetime import datetime, timedelta
|
||||
import cv2
|
||||
import time
|
||||
|
||||
|
||||
while True:
|
||||
|
||||
|
||||
cdate = datetime.now()
|
||||
try:
|
||||
base_path = cdate.strftime('/home/thebears/Videos/Winslow/%Y%m%d/snapshots/')
|
||||
prestr = base_path + cdate.strftime('%Y%m%d_%H%M%S')
|
||||
|
||||
if not os.path.exists(base_path):
|
||||
os.makedirs(base_path)
|
||||
|
||||
|
||||
video_obj = dict()
|
||||
video_obj[1] = cv2.VideoCapture('http://localhost:6082/frame.mjpg')
|
||||
video_obj[2] = cv2.VideoCapture('http://localhost:6083/frame.mjpg')
|
||||
video_obj[3] = cv2.VideoCapture('http://localhost:6084/frame.mjpg')
|
||||
video_obj[4] = cv2.VideoCapture('http://localhost:6085/frame.mjpg')
|
||||
video_obj[5] = cv2.VideoCapture('http://localhost:6086/frame.mjpg')
|
||||
|
||||
|
||||
for idx, obj in video_obj.items():
|
||||
filepath = prestr + '_' + str(idx) +'.jpg'
|
||||
print(filepath)
|
||||
(success, image) = obj.read()
|
||||
cv2.imwrite(filepath, image)
|
||||
obj.release()
|
||||
except Exception as E:
|
||||
print(E)
|
||||
|
||||
|
||||
time.sleep(15)
|
||||
Reference in New Issue
Block a user