Ask Your Question
0

Problems with rectified pictures for stereo vision

asked 2016-03-07 12:12:27 -0600

Bilou563 gravatar image

I m trying to do stereo matching but it doesnt work well until now. I determined the "tvecs" and "rvecs" for each camera. So i can use these relationships to get the translation vector and rotation matrix :

R = Rright.Rleft.T and T = Tright - R.Tleft
with the meaned values of Tleft , Tright, Rright and Rleft

But i have a problem during the rectification step... The scale of rectified pictures have changed...and i dont know how to fix it...

A piece of my code for the left picture :

#i obtained the new camera matrix for the rectification 
C1new = cv2.getOptimalNewCameraMatrix(C1,dist1,(2048,2048),alpha=1)[0] #with C1 and dist1 respectively the #camera matrix and the distorsion values 

#and i obtained the map and i remap... 
left_maps = cv2.initUndistortRectifyMap(C1, dist1, R1, C1new, (2048, 2048), cv2.CV_32FC2) 
a = left_maps[0] 
left_img_remap = cv2.remap(left_stereo_image2, a[:,:,0], a[:,:,1], cv2.INTER_CUBIC)

And i got that... :

image description

To improve my results i tried to concatenate empty arrays to plot all the picture but when i do that and modify the size in "getOptimalNewCameraMatrix" and "initUndistortRectifyMap", i got :

image description

This time i got all the pictures but the scale between them is not good...so i cant determine disparity... Thanks for your help ;)

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-06-12 16:37:46 -0600

minok gravatar image

Hey, I guess you probably won't visit this topic after 3 months, but I will still give it a shot. By any chance, have you solved this problem yet? I'm currently at the same state, I can't move on with 3D reconstruction because objects on the new images are somehow resized. Cheers.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-03-07 12:12:27 -0600

Seen: 487 times

Last updated: Jun 12 '16