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
|
# Check for left and right camera IDs
|
||||||
# These values can change depending on the system
|
# These values can change depending on the system
|
||||||
CamL_id = 1# Camera ID for left camera
|
CamL_id = 6# Camera ID for left camera
|
||||||
CamR_id = 5# Camera ID for right camera
|
CamR_id = 8# Camera ID for right camera
|
||||||
|
|
||||||
CamL= cv2.VideoCapture(CamL_id)
|
CamR= cv2.VideoCapture(CamR_id, cv2.CAP_V4L2)
|
||||||
CamR= cv2.VideoCapture(CamR_id)
|
CamL= cv2.VideoCapture(CamL_id, cv2.CAP_V4L2)
|
||||||
|
'''
|
||||||
|
while True:
|
||||||
|
ret, frame = CamR.read()
|
||||||
|
if ret:
|
||||||
retL, imgL= CamL.read()
|
codec=CamR.get(cv2.CAP_PROP_FOURCC)
|
||||||
retR, imgR= CamR.read()
|
print("codec: ",codec)
|
||||||
|
sdfgh
|
||||||
imgR_gray = cv2.cvtColor(imgR,cv2.COLOR_BGR2GRAY)
|
'''
|
||||||
imgL_gray = cv2.cvtColor(imgL,cv2.COLOR_BGR2GRAY)
|
|
||||||
print("la c bon")
|
|
||||||
# Reading the mapping values for stereo image rectification
|
# Reading the mapping values for stereo image rectification
|
||||||
cv_file = cv2.FileStorage("data/params_py.xml", cv2.FILE_STORAGE_READ)
|
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_x = cv_file.getNode("Left_Stereo_Map_x").mat()
|
||||||
|
|
||||||
Left_Stereo_Map_y = cv_file.getNode("Left_Stereo_Map_y").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_x = cv_file.getNode("Right_Stereo_Map_x").mat()
|
||||||
Right_Stereo_Map_y = cv_file.getNode("Right_Stereo_Map_y").mat()
|
Right_Stereo_Map_y = cv_file.getNode("Right_Stereo_Map_y").mat()
|
||||||
cv_file.release()
|
cv_file.release()
|
||||||
|
|
||||||
|
|
||||||
def nothing(x):
|
def nothing(x):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
@ -47,12 +48,14 @@ cv2.createTrackbar('minDisparity','disp',5,25,nothing)
|
||||||
|
|
||||||
# Creating an object of StereoBM algorithm
|
# Creating an object of StereoBM algorithm
|
||||||
stereo = cv2.StereoBM_create()
|
stereo = cv2.StereoBM_create()
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|
||||||
# Capturing and storing left and right camera images
|
# Capturing and storing left and right camera images
|
||||||
retL, imgL= CamL.read()
|
retL, imgL= CamL.read()
|
||||||
retR, imgR= CamR.read()
|
retR, imgR= CamR.read()
|
||||||
|
|
||||||
|
waitkey(0)
|
||||||
# Proceed only if the frames have been captured
|
# Proceed only if the frames have been captured
|
||||||
if retL and retR:
|
if retL and retR:
|
||||||
imgR_gray = cv2.cvtColor(imgR,cv2.COLOR_BGR2GRAY)
|
imgR_gray = cv2.cvtColor(imgR,cv2.COLOR_BGR2GRAY)
|
||||||
|
|
@ -122,7 +125,7 @@ while True:
|
||||||
else:
|
else:
|
||||||
CamL= cv2.VideoCapture(CamL_id)
|
CamL= cv2.VideoCapture(CamL_id)
|
||||||
CamR= cv2.VideoCapture(CamR_id)
|
CamR= cv2.VideoCapture(CamR_id)
|
||||||
|
waitKey(0)
|
||||||
print("Saving depth estimation paraeters ......")
|
print("Saving depth estimation paraeters ......")
|
||||||
|
|
||||||
cv_file = cv2.FileStorage("../data/depth_estmation_params_py.xml", cv2.FILE_STORAGE_WRITE)
|
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