-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdup2.py
81 lines (58 loc) · 2.01 KB
/
dup2.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import numpy as np
import cv2, time, os
#video = cv2.VideoCapture(1)
#video1 = cv2.VideoCapture('rtsp://admin:[email protected]:554/live/main')
#video2 = cv2.VideoCapture('rtsp://admin:[email protected]:554/live/main')
#video1 = cv2.VideoCapture('rtsp://admin:[email protected]:554/1/1')
#video2 = cv2.VideoCapture('rtsp://admin:[email protected]:554/1/1')
video1 = cv2.VideoCapture('rtsp://rtsp:[email protected]:28189/axis-media/media.amp')
video2 = cv2.VideoCapture('rtsp://rtsp:[email protected]:28190/axis-media/media.amp')
video3 = cv2.VideoCapture('rtsp://rtsp:[email protected]:28187/axis-media/media.amp')
video4 = cv2.VideoCapture('rtsp://rtsp:[email protected]:28188/axis-media/media.amp')
#video.set(cv2.CAP_PROP_FRAME_WIDTH, 320)
#video.set(cv2.CAP_PROP_FRAME_HEIGHT, 240)
d = ''
na = 816
path = 'temp'
while(True):
# Capture frame-by-frame
ret, frame1 = video1.read()
ret, frame2 = video2.read()
ret, frame3 = video3.read()
ret, frame4 = video4.read()
#time.sleep(0.1)
# Display the resulting frame
if ret:
try:
small1 = cv2.resize(frame1, (900,450))
small2 = cv2.resize(frame2, (900,450))
small3 = cv2.resize(frame3, (640,320))
small4 = cv2.resize(frame4, (640,320))
cv2.imshow('Left',small1)
cv2.imshow('Right',small2)
cv2.imshow('inDoor',small3)
cv2.imshow('outDoor',small4)
except:
pass
else:
break
inn = cv2.waitKey(1) & 0xFF
if inn == ord('q'):
break
if inn & 0xFF == ord(' '):
print('save')
im_na_L = 'Can/waka_'+str(na)+'_'+d+'_L.jpg'
im_na_R = 'Can/waka_'+str(na)+'_'+d+'_R.jpg'
na = na+1
cv2.imwrite(im_na_R, frame2)
cv2.imwrite(im_na_L, frame1)
im_na_in = 'Can/road/waka_'+str(na)+'_'+d+'_in.jpg'
im_na_out = 'Can/road/waka_'+str(na)+'_'+d+'_out.jpg'
cv2.imwrite(im_na_in, frame3)
cv2.imwrite(im_na_out, frame4)
video1.release()
video2.release()
video3.release()
video4.release()
cv2.destroyAllWindows()
print (na)