I am trying to calibrate a stereo camera using OpenCV (python interface). I first calibrated the two cameras separately using calibrateCamera2, and then passed the parameters to stereo calibration
cv.StereoCalibrate(object_points, image_points_left, image_points_right, \
point_counts, intrinsic_left, distortion_left,\
intrinsic_right, distortion_right, \
(IMGRES_X,IMGRES_Y), R, T, E, F, \
term_crit=(cv.CV_TERMCRIT_ITER+cv.CV_TERMCRIT_EPS, 100, 1e-8),\
flags=cv.CV_CALIB_FIX_INTRINSIC)
I check the result with an epipolar constraint (as described in the OpenCV book) and get an average error of around 0.0039.
In principle, I should be able to connect the fundamental and essential matrix with the matrices of my camera. So what I do:
Mr = asarray(intrinsic_right,dtype=float64)
Ml = asarray(intrinsic_left,dtype=float64)
E = asarray(E)
F = asarray(F)
F2 = dot(dot(inv(Mr).T,E),inv(Ml))
However, the resulting matrix F2 is completely different from F. Is there something obvious that I'm doing wrong? Help is much appreciated.
Edit: dot and inv from numpy.