0
votes

I'm working on a project where i have to calibrate the camera in order to calculate the camera matrix and use it for other processes

I calibrated the camera using Zahng's method (Checkerboard) and performed the calibration using two different tools: 1- Matlab calibration tool 2-OpenCV method (cv2.calibrateCamera())

for both methods i used the same images (16 images).

the result form Matlab

4380.06266797091                0                0 
    0                    4374.31691291339        0
949.990213743877         664.725183192415        1

#Radial Distortion Coefficient
-0.355521260561817  1.30195034883959

#tangational Distortion Coefficient
0   0 

#average REPROJECTION ERROR
0.513903578285060
----------------------------------------------------

The results form OpenCV code

#camera matrix
mtx [[4.38350928e+03 0.00000000e+00 9.73653727e+02]
    [0.00000000e+00 4.37873075e+03 6.68924323e+02]
    [0.00000000e+00 0.00000000e+00 1.00000000e+00]]

#Distortion Coefficients
dist [[-3.59709752e-01  3.91496111e+00  3.43950578e-03  1.01871917e-03
      -6.21911790e+01]]

So my questions are:

1-Which results are considered to be more accurate as the Principal point differs a little bit

2-Why OpenCV considers 5 Distortion Coefficients whereas Matlab considers 4 (two are zero where in Opencv are not!)

Thanks in Advance

1
See mathworks.com/help/vision/ug/single-camera-calibrator-app.html#. In Matlab you can choose either 2 or 3 radial distortion coefficients and get the 2 tangential coefficients as well. See opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/…. So in Opencv you get 5 coefficients: 3 radial and 2 tangential. The order is different in the return coefficients from OpenCV and Matlab. But the results should be equivalent if the distortion equations are the same. See what you get if you use 3 radial coefficients in Matlab.fmw42
In OpenCV, your tangential coefficients are very small 3.43950578e-03 1.01871917e-03 and likely are negligible. In Matlab you got 0 and 0 for the two. Differences may be due to precision. But may be negligible in their effects.fmw42
Did you include skew in Matlab. I believe OpenCV includes it.fmw42
You have not shown those difference. Please do so. But first make both models equivalent as described above.fmw42
Which one has the smaller residuals? Or project points from 3D to 2D in both and see how different they are. They are likely insignificant or within error tolerances.fmw42

1 Answers

0
votes

The comments have lead me to the solution of the problem. Credit to @fmw42