From b050c1a5f41ce4aa2c4be26ea7efa9b25e13a88b Mon Sep 17 00:00:00 2001 From: "eliott.laurent" Date: Wed, 17 May 2023 17:29:04 +0200 Subject: [PATCH] pas grand chose de nouveau --- dispa2depth.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/dispa2depth.py b/dispa2depth.py index 2558c16..7cb85c8 100644 --- a/dispa2depth.py +++ b/dispa2depth.py @@ -17,10 +17,11 @@ retR, imgR= cv2.VideoCapture(CamR_id, cv2.CAP_V4L2).read() imgR_gray = cv2.cvtColor(imgR,cv2.COLOR_BGR2GRAY) imgL_gray = cv2.cvtColor(imgL,cv2.COLOR_BGR2GRAY) ''' + # 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() -print(Left_Stereo_Map_x) +#print(Left_Stereo_Map_x) 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() @@ -80,6 +81,9 @@ while True: retL, imgL= cv2.VideoCapture(CamL_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() retL, imgL= CamL.read() ''' @@ -87,13 +91,14 @@ while True: if retL and retR: imgR_gray = cv2.cvtColor(imgR,cv2.COLOR_BGR2GRAY) imgL_gray = cv2.cvtColor(imgL,cv2.COLOR_BGR2GRAY) + ''' cv2.imshow('imgL_gray',imgL_gray) cv2.imshow('imgR_gray',imgR_gray) - cv2.waitKey(33) - + cv2.waitKey(0) ''' + # Applying stereo image rectification on the left image Left_nice= cv2.remap(imgL_gray, Left_Stereo_Map_x, @@ -101,7 +106,9 @@ while True: cv2.INTER_LANCZOS4, cv2.BORDER_CONSTANT, 0) - + cv2.imshow('imgL nice',Left_nice) + cv2.waitKey(0) + #print(Left_nice) # Applying stereo image rectification on the right image Right_nice= cv2.remap(imgR_gray, Right_Stereo_Map_x, @@ -109,7 +116,9 @@ while True: cv2.INTER_LANCZOS4, cv2.BORDER_CONSTANT, 0) - + cv2.imshow('imgR nice',Right_nice) + cv2.waitKey(0) + # Setting the updated parameters before computing disparity map stereo.setNumDisparities(numDisparities) stereo.setBlockSize(blockSize)