problem with stereoRectify() results [magnified output]
Hello, newbie here. I have problems concerning the rectification of a stereo image pair. I have as a input videos from a pair of cameras attached to a stereo microscope. My final task is to 3D reconstruct the result. At this point I have stereo calibrated them with a reprojection error of about 1.1 per camera and 4 for the stereo result. After, I pass the calibration results for stereo rectification in stereoRectify() and remap.
stereoRectify(KL , DL , KR , DR , image_size , R , T , R1 , R2 , P1 , P2 , Q , 0, 0.01 ) ;
initUndistortRectifyMap(KL,DL,R1,P1,image_size, CV_16SC2 , map11, map12) ;
initUndistortRectifyMap(KR,DR,R2,P2,image_size, CV_16SC2 , map21, map22) ;
remap(initial_image[0],remappedImage0, map11,map12, INTER_LINEAR, BORDER_CONSTANT, Scalar());
remap(initial_image[1],remappedImage1, map21,map22, INTER_LINEAR, BORDER_CONSTANT, Scalar());
Now the output image pair looks rectified, but its a scaled up version of the input. Actually I see only a magnified region of the center on both final images as the rectification result.
I try to realize why this is happening, but I'm still missing something and I'm stuck. Is there any hint or reference or someone that has faced similar problems in the past? I attach a couple of images for reference. One is with the pair of the original and the rectified image (where the zoom in is obvious), and the second one is the rectification result.
Any help would be invaluable. My opencv version is 3.4.5 on Linux Mint 18.3
-A pair of the original and the rectified image
- Stereo rectification image pair
The stretching along the Y axis makes me think your calibration might have misdetected values stored in a K matrix (fx, fy, cx, cy), or come up with some invalid distortion matrix values. Could you include left and right original images, left and right K and D matrices, right R and T matrices? Also, discuss your procedure and tools for both mono (left and right K and D) and stereo (right R and T) calibration. We can probably get to the bottom of this.
Hello, first of all, thank you for the answer. When I tried to reproduce my calibration results, I found a error score near 1.2 for each camera but a big stereo calibration error in the scale around 13-14 (which I didn't notice at first). So now I took new videos to test my calibration again and after I will post what happened, if the rectification result was clearly an error of the calibration procedure or if the problem persists. Best regards