branch dev tout marche pas, test12 and paramgui
This commit is contained in:
parent
2c3aee2937
commit
f65b4fa45a
|
|
@ -4,29 +4,30 @@ import cv2
|
|||
|
||||
# Check for left and right camera IDs
|
||||
# These values can change depending on the system
|
||||
CamL_id = 1# Camera ID for left camera
|
||||
CamR_id = 5# Camera ID for right camera
|
||||
CamL_id = 6# Camera ID for left camera
|
||||
CamR_id = 8# Camera ID for right camera
|
||||
|
||||
CamL= cv2.VideoCapture(CamL_id)
|
||||
CamR= cv2.VideoCapture(CamR_id)
|
||||
|
||||
|
||||
|
||||
|
||||
retL, imgL= CamL.read()
|
||||
retR, imgR= CamR.read()
|
||||
|
||||
imgR_gray = cv2.cvtColor(imgR,cv2.COLOR_BGR2GRAY)
|
||||
imgL_gray = cv2.cvtColor(imgL,cv2.COLOR_BGR2GRAY)
|
||||
print("la c bon")
|
||||
CamR= cv2.VideoCapture(CamR_id, cv2.CAP_V4L2)
|
||||
CamL= cv2.VideoCapture(CamL_id, cv2.CAP_V4L2)
|
||||
'''
|
||||
while True:
|
||||
ret, frame = CamR.read()
|
||||
if ret:
|
||||
codec=CamR.get(cv2.CAP_PROP_FOURCC)
|
||||
print("codec: ",codec)
|
||||
sdfgh
|
||||
'''
|
||||
# Reading the mapping values for stereo image rectification
|
||||
cv_file = cv2.FileStorage("data/params_py.xml", cv2.FILE_STORAGE_READ)
|
||||
|
||||
Left_Stereo_Map_x = cv_file.getNode("Left_Stereo_Map_x").mat()
|
||||
|
||||
Left_Stereo_Map_y = cv_file.getNode("Left_Stereo_Map_y").mat()
|
||||
Right_Stereo_Map_x = cv_file.getNode("Right_Stereo_Map_x").mat()
|
||||
Right_Stereo_Map_y = cv_file.getNode("Right_Stereo_Map_y").mat()
|
||||
cv_file.release()
|
||||
|
||||
|
||||
def nothing(x):
|
||||
pass
|
||||
|
||||
|
|
@ -47,12 +48,14 @@ cv2.createTrackbar('minDisparity','disp',5,25,nothing)
|
|||
|
||||
# Creating an object of StereoBM algorithm
|
||||
stereo = cv2.StereoBM_create()
|
||||
|
||||
while True:
|
||||
|
||||
# Capturing and storing left and right camera images
|
||||
retL, imgL= CamL.read()
|
||||
retR, imgR= CamR.read()
|
||||
|
||||
waitkey(0)
|
||||
# Proceed only if the frames have been captured
|
||||
if retL and retR:
|
||||
imgR_gray = cv2.cvtColor(imgR,cv2.COLOR_BGR2GRAY)
|
||||
|
|
@ -122,7 +125,7 @@ while True:
|
|||
else:
|
||||
CamL= cv2.VideoCapture(CamL_id)
|
||||
CamR= cv2.VideoCapture(CamR_id)
|
||||
|
||||
waitKey(0)
|
||||
print("Saving depth estimation paraeters ......")
|
||||
|
||||
cv_file = cv2.FileStorage("../data/depth_estmation_params_py.xml", cv2.FILE_STORAGE_WRITE)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
import cv2
|
||||
|
||||
ID1 = 6
|
||||
ID2 = 8
|
||||
cam1 = cv2.VideoCapture(ID1, cv2.CAP_V4L2)
|
||||
cam1.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc(*'MJPG'))
|
||||
cam2 = cv2.VideoCapture(ID2, cv2.CAP_V4L2)
|
||||
cam2.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc(*'MJPG'))
|
||||
|
||||
while True:
|
||||
ret1, frame1 = cam1.read()
|
||||
ret2, frame2 = cam2.read()
|
||||
|
||||
cv2.imshow('Camera 1', frame1)
|
||||
cv2.imshow('Camera 2', frame2)
|
||||
|
||||
if cv2.waitKey(1) == ord('q'):
|
||||
break
|
||||
cam1.release()
|
||||
cam2.release()
|
||||
cv2.destroyAllWindows()
|
||||
Loading…
Reference in New Issue