cv::stereoRectify, the vertical case is broken (OpenCV 2.3.1) (Bug #2131)
Description
I'm using OpenCV 2.3.1. It has to be verified if this problem also occurs in the most recent version.
I have a camera setup where the cameras have a large relative rotation, but which does rather fit into the horizontal stereo case. Nevertheless cv::stereoRectify decides that it belongs to the vertical case. Unfortunately, the resulting rectified images are quite wrong. The rotation looks right but there is a large vertical displacement. I have copied the opencv code into my code and hardcoded idx to equal 0 (which means the horizontal case). The rectified images were well aligned. So I guess either the decision which case to choose was wrong or there is some bug in the vertical case.
For reproduction purposes I will provide the images and the calibration:
Camera1:
Camera matrix:
[609.1754765941076, 0, 378.0906008255727;
0, 609.0472843296455, 252.0023221227853;
0, 0, 1]
Distortion parameter:
[-0.1202344589011157, 0.1107038894107597, 0, 0, 0]
Camera2:
Camera matrix:
[611.286361996483, 0, 371.6990964777331;
0, 610.8884711974937, 247.4188722077607;
0, 0, 1]
Distortion parameter:
[-0.1198012997359015, 0.1136902483687719, 0, 0, 0]
Stereo Calibration:
Rotation:
[0.5046657748002958, -0.7595272387204677, -0.4104032521641111;
0.740902496182031, 0.6250544208924098, -0.2457040131420117;
0.4431432577580897, -0.1800703878057581, 0.8781792006982581]
Translation:
[-0.1179336247059365; 0.08857313307820733; -0.04750346134884339]
History
Updated by Tobias Langner over 12 years ago
I'm sorry. I hadn't realized, that in the vertical stereo case the rectified images are meant to be stacked on top of each other. So everything works fine. But I would like to have a flag which lets the caller decide which case to use. Default value could be the automatic decision as it is implemented now.