-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.py
42 lines (31 loc) · 890 Bytes
/
Main.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 numpy as np
import cv2 as cv
#Global Variables
Wid= 1344 #widht of frame
Mid= Wid/2 #Middle of frame
Hei= 376 #Height of frame
#Capture of Stereo Camera
Cam=cv.VideoCapture(1)
if not Cam.isOpened():
print("Cannot open camera")
exit()
while True:
ret, frame=Cam.read()
gray=cv.cvtColor(frame,cv.COLOR_BGR2GRAY)
#Separation of frames
imgL = gray[0:Hei, 0:Mid]
imgR = gray[0:Hei, Mid:Wid]
if not ret:
print("Can't receive frame")
break
cv.imshow("Right",imgL)
cv.imshow("Left",imgR)
if cv.waitKey(1)&0xFF==ord('s'):
cv.imwrite('fr1.png',imgR)
cv.imwrite('fl1.png',imgL)
######################################
if cv.waitKey(1)&0xFF==ord('q'):
break
Cam.release()
cv.destroyAllWindows()
######################################