I am trying to calibrate a stereo setup consisiting of two identical Canon EOS60D
's, which i will be using to do Photogrammetry.
To calibrate cameras i am using a high precision circlegrid
pattern plate. I was able to detect centre points of circles using cv2.findCirclesGrid
, and was able to calibrate a single camera just fine. The problem comes when i try to calibrate both cameras using cv2.stereoCalibrate
function in OpenCV.
I will elucidate the steps taken and also post some code snippets with outputs i have got. I would be grateful if someone can point out where i am doing wrong.
Steps
1) First step is to detect circlegrid pattern using cv2.findCirclesGrid
function in OpenCV.
2) Then using the detected grid pattern from each camera, i am using cv2.calibrateCamera
to get camera matrices, and distortion coefficients of both cameras.
3) After getting camera matrices and distortion coefficients of both cameras, i am passing them to cv2.stereoCalibrate
function.
Output
output after calibrating Left Camera is as follows
Left Camera Return Value : 0.202690712694
Left Camera Camera Matrix : [[ 2.42046647e+04 0.00000000e+00 1.78281995e+03]
[ 0.00000000e+00 2.42115121e+04 2.51720578e+03]
[ 0.00000000e+00 0.00000000e+00 1.00000000e+00]]
Left Camera Dist Coeff : [[-0.09448288 -1.38934436 0.00951455 -0.00568115 0.11248399]]
output after calibrating Right camera is as follows
Right Camera Return value : 0.258429588138
Right Camera Camera Matrix : [[ 2.69094574e+04 0.00000000e+00 1.70580157e+03]
[ 0.00000000e+00 2.69534209e+04 2.55185400e+03]
[ 0.00000000e+00 0.00000000e+00 1.00000000e+00]]
Right Camera Dist Coeff : [[-0.1854594 1.89124255 0.00592814 -0.00377697 0.05715002]]
As you can see from the output above, both the return values from cv2.calibrateCamera
are reasonable.
output after calibrating stereo setup is as follows
StereoCalib Return Value : 278.98818985
Rotation Vector : [[ 0.72415334 0.13289823 0.67671265]
[ 0.68078781 0.018949 -0.73223554]
[-0.11013584 0.99094853 -0.07675351]]
Translation Vector [[-1.20860215]
[ 1.23017549]
[ 2.08116679]]
Essential Matrix : [[-1.55231939 1.17960457 1.42948401]
[ 1.37397347 1.47424592 1.31558743]
[-1.7136373 -0.18638995 0.05250614]]
Fundamental Matrix : [[ -3.15554184e-07 2.39721211e-07 6.99264445e-03]
[ 2.78844610e-07 2.99110045e-07 5.21248054e-03]
[ -9.54712002e-03 -2.19149124e-03 1.00000000e+00]]
But the return value from stereo calibration is too high.
Params
The flags and criteria i am using in cv2.stereoCalibrate
are as follows
flags = cv2.CALIB_FIX_INTRINSIC
criteria = cv2.TERM_CRITERIA_MAX_ITER + cv2.TERM_CRITERIA_EPS, 1000, 1e-6
I would be grateful if somebody can point me where i am doing wrong.