Stereo Rectification produces rectified images of only the top left quarter of the original image

asked 2020-06-15 17:21:02 -0600

Alex Liu gravatar image

updated 2020-06-16 03:28:27 -0600

supra56 gravatar image

I took a series of photos with 2 cameras placed side by side in order to perform stereo calibration. I ran the photos through the steps of stereo calibration, got the camera parameters through cv2.stereoCalibrate, ran the parameters through cv2.stereoRectify and got the rotation and coordinate matrices R1, P1, R2, and P2. I put the results through cv2.initUndistortRectifyMap and received the undistortion and rectification maps map1x, map1y, map2x, and map2y. Finally, I applied the maps using cv2.remap on some images. However, the resulting rectified images I get consists of black pixels for 3/4th of the image, only showing valid pixels in the bottom right corner. I realize that the non-black pixels corresponds to the top left corner of my original image. The first image below is my original image, the second is the corresponding "rectified image".

image description

image description

I have not been able to find a similar problem encountered by others using the same procedure. I did not change the size of the image during any of my steps. In stereoRectify and initUndistortRectifyMap, I used the (width, height) I obtained from the original image. Any input on this problem is appreciated. Thank you.

edit retag flag offensive close merge delete

Comments

That's strange, are you sure that you get the correct calibration matrices? It look like it is shifted, have you tried again the procedure?

HYPEREGO gravatar imageHYPEREGO ( 2020-06-17 04:39:27 -0600 )edit