I have calibrated my cameras using OpenCV. I used cv.stereoCalibrate to get the E, and F matrices. I wanted to do a sanity check to see if the E matrix obtained is the same from what is manually computed, but I did not get the same results.

I am using E = np.dot(np.dot(K2.T, F), K1)

K2 is the Second (Right) Camera Matrix & K1 is the First (Left) Camera Matrix.

The values obtained from cv.stereoCalibrate are -

K1 = array([[934.06230207,   0.        , 959.99754346],
           [  0.        , 933.44096222, 539.98442119],
           [  0.        ,   0.        ,   1.        ]])
K2 = array([[935.93262747,   0.        , 960.00167839],
            [  0.        , 936.1379955 , 539.98789096],
            [  0.        ,   0.        ,   1.        ]])
E = array([[-4.27815162e-05, -6.90641692e-02,  3.35371623e-02],
          [ 5.78660464e-02,  1.37740833e-02,  1.20282641e+01],
          [-3.54642135e-02, -1.20281991e+01,  1.37524047e-02]])
F = array([[-1.45461342e-09, -2.34981243e-06,  2.33536635e-03],
           [ 1.96707058e-06,  4.68541244e-07,  3.79780838e-01],
           [-2.18936224e-03, -3.81020843e-01,  1.00000000e+00]])

If I compute E = np.dot(np.dot(K2.T, F), K1) I get

E = array([[-1.27165124e-03, -2.05288509e+00,  9.96869161e-01],
          [ 1.72002857e+00,  4.09425185e-01,  3.57531907e+02],
           [-1.05414944e+00, -3.57529974e+02,  4.08780803e-01]])

This is not equal to the E I got from OpenCV. enter code here

  • $\begingroup$ Welcome to Robotics, PyWalker2797. What results are you getting? Where are K2 and K1 coming from? Why are they different? $\endgroup$ – Chuck May 19 '20 at 14:48
  • $\begingroup$ I updated my question with some more information. K2 and K1 are the camera matrices of the second and first camera respectively. $\endgroup$ – PyWalker2797 May 19 '20 at 14:57

How are you calling the function? The documentation says:

And the function can also compute the fundamental matrix F:

F = cameraMatrix2^{-T} E cameraMatrix1^{-1}

And checking this doesn't give a correct/matching number either, so I'm wondering if maybe you've left an argument out and it's causing and off-by-one error that's failing to send the right parameter to the correct output.

  • $\begingroup$ I will check but I am passing all the parameters correctly and passing None for parameters that don't need values so that the order does not get messed up $\endgroup$ – PyWalker2797 May 19 '20 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.