stereoRectify returns wrong reprojection matrix Q (Bug #898)


Added by Chris Beall about 14 years ago. Updated almost 13 years ago.


Status:Done Start date:
Priority:High Due date:
Assignee:Ilya Lysenkov % Done:

0%

Category:calibration, 3d
Target version:2.4.0
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

As stated in the Learning OpenCV book, the reprojection matrix element Q(3, 2) should be -1/T_x, but it currently returns 1/Tx. I believe -1/T_x is the correct value.

code from stereoRectify:

 double q[] =
        {
            1, 0, 0, -cc_newr0.x,
            0, 1, 0, -cc_newr0.y,
            0, 0, 0, fc_new,
            0, 0, 1./_t[idx], <---- incorrect
            (idx == 0 ? cc_newr0.x - cc_newr1.x : cc_newr0.y - cc_newr1.y)/_t[idx]
        };

To verify, I'm attaching a Matlab script which projects a 3D point into both cameras, and then uses Q to reproject to 3D. As expected, the resulting 3D point lies behind the camera. I am assuming that disparity is defined as d=u_L - u_R, i.e disparity values are positive for stereo pairs where the left & right principal points are identical.


bouguet_example.m - Matlab example (2.3 kB) Chris Beall, 2011-02-16 09:21 pm


Associated revisions

Revision 3b5b20b7
Added by Ilya Lysenkov almost 13 years ago

Fixed wrong computation of a reprojection matrix Q in stereoRectify (#898)

History

Updated by Alexander Shishkov about 13 years ago

  • Description changed from As stated in the Learning [[OpenCV]] book, the reprojection matrix element Q(... to As stated in the Learning OpenCV book, the reprojection matrix element Q(3, 2... More

Updated by Alexander Shishkov almost 13 years ago

  • Description changed from As stated in the Learning OpenCV book, the reprojection matrix element Q(3, 2... to As stated in the Learning OpenCV book, the reprojection matrix element Q(3, 2... More

Updated by Alexander Shishkov almost 13 years ago

  • Target version deleted ()

Updated by Alexander Shishkov almost 13 years ago

  • Assignee deleted (Vadim Pisarevsky)

Updated by Ilya Lysenkov almost 13 years ago

  • Assignee set to Ilya Lysenkov

Updated by Ilya Lysenkov almost 13 years ago

Thank you a lot for the report. Indeed, this value was incorrect. It is fixed in r7666.

  • Status changed from Open to Done

Updated by Alexander Shishkov almost 13 years ago

  • Target version set to 2.4.0

Also available in: Atom PDF