pas grand chose de nouveau

This commit is contained in:
Eliott LAURENT 2023-05-17 17:29:04 +02:00
parent 7a318e668c
commit b050c1a5f4
1 changed files with 14 additions and 5 deletions

View File

@ -17,10 +17,11 @@ retR, imgR= cv2.VideoCapture(CamR_id, cv2.CAP_V4L2).read()
imgR_gray = cv2.cvtColor(imgR,cv2.COLOR_BGR2GRAY) imgR_gray = cv2.cvtColor(imgR,cv2.COLOR_BGR2GRAY)
imgL_gray = cv2.cvtColor(imgL,cv2.COLOR_BGR2GRAY) imgL_gray = cv2.cvtColor(imgL,cv2.COLOR_BGR2GRAY)
''' '''
# 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()
print(Left_Stereo_Map_x) #print(Left_Stereo_Map_x)
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()
@ -80,6 +81,9 @@ while True:
retL, imgL= cv2.VideoCapture(CamL_id, cv2.CAP_V4L2).read() retL, imgL= cv2.VideoCapture(CamL_id, cv2.CAP_V4L2).read()
retR, imgR= cv2.VideoCapture(CamR_id, cv2.CAP_V4L2).read() retR, imgR= cv2.VideoCapture(CamR_id, cv2.CAP_V4L2).read()
''' '''
cv2.imshow('imgL',imgL)
cv2.waitKey(0)
retR, imgR= CamR.read() retR, imgR= CamR.read()
retL, imgL= CamL.read() retL, imgL= CamL.read()
''' '''
@ -87,13 +91,14 @@ while True:
if retL and retR: if retL and retR:
imgR_gray = cv2.cvtColor(imgR,cv2.COLOR_BGR2GRAY) imgR_gray = cv2.cvtColor(imgR,cv2.COLOR_BGR2GRAY)
imgL_gray = cv2.cvtColor(imgL,cv2.COLOR_BGR2GRAY) imgL_gray = cv2.cvtColor(imgL,cv2.COLOR_BGR2GRAY)
''' '''
cv2.imshow('imgL_gray',imgL_gray) cv2.imshow('imgL_gray',imgL_gray)
cv2.imshow('imgR_gray',imgR_gray) cv2.imshow('imgR_gray',imgR_gray)
cv2.waitKey(33) cv2.waitKey(0)
''' '''
# Applying stereo image rectification on the left image # Applying stereo image rectification on the left image
Left_nice= cv2.remap(imgL_gray, Left_nice= cv2.remap(imgL_gray,
Left_Stereo_Map_x, Left_Stereo_Map_x,
@ -101,7 +106,9 @@ while True:
cv2.INTER_LANCZOS4, cv2.INTER_LANCZOS4,
cv2.BORDER_CONSTANT, cv2.BORDER_CONSTANT,
0) 0)
cv2.imshow('imgL nice',Left_nice)
cv2.waitKey(0)
#print(Left_nice)
# Applying stereo image rectification on the right image # Applying stereo image rectification on the right image
Right_nice= cv2.remap(imgR_gray, Right_nice= cv2.remap(imgR_gray,
Right_Stereo_Map_x, Right_Stereo_Map_x,
@ -109,7 +116,9 @@ while True:
cv2.INTER_LANCZOS4, cv2.INTER_LANCZOS4,
cv2.BORDER_CONSTANT, cv2.BORDER_CONSTANT,
0) 0)
cv2.imshow('imgR nice',Right_nice)
cv2.waitKey(0)
# Setting the updated parameters before computing disparity map # Setting the updated parameters before computing disparity map
stereo.setNumDisparities(numDisparities) stereo.setNumDisparities(numDisparities)
stereo.setBlockSize(blockSize) stereo.setBlockSize(blockSize)