How can we confirm that the intrinsic matrix is correct?

2.5k views Asked by At

I performed camera calibration using aruco markers. Since the intrinsic matrix is K = [fx 0 cx; 0 fy cy; 0 0 1] and where fx = image_width/2 and fy = image_height/2. I performed the calibration twice and the results are:

CASE 1

camera_matrix: !!opencv-matrix
   rows: 3
   cols: 3
   dt: d
   data: [ 1.7837087835808685e+004, 0., 9.4648597205501767e+002, 0.,
       1.7846680517567835e+004, 6.2655678552312384e+002, 0., 0., 1. ]
distortion_coefficients: !!opencv-matrix
   rows: 1
   cols: 5
   dt: d
   data: [ 1.3214125616841757e-001, 1.3720591379476604e+001,
       4.1379706976846960e-003, 3.2630160993931338e-002,
       7.2446581087476508e-002 ]

CASE 2

camera_matrix: !!opencv-matrix
   rows: 3
   cols: 3
   dt: d
   data: [ 3.9925887362481939e+004, 0., 9.6015637557091463e+002, 0.,
       3.5268399261164773e+003, 5.9886507612381956e+002, 0., 0., 1. ]
distortion_coefficients: !!opencv-matrix
   rows: 1
   cols: 5
   dt: d
   data: [ 4.4338539084399781e-001, 4.9217843346948866e+000,
       5.8004377137432547e-002, 1.1762688789809046e-004,
       -5.4097967557812456e+002 ]

The resolution of the image is 1920*1200, so cx and cy should be 960 and 600. In the 2nd case, cx and cy are as expected; the re-projection error is large. In other case cx and cy are not matching but the re-projection error is quite low (less than 1).

So now which results can be considered and best and how can fx and fy be defined in general?

2

There are 2 answers

2
willem On

You are correct that cx and cy should be close to 960 and 600. From this standpoint, case 2 seems somewhat more likely, but case 1 is certainly plausible with a center point of (946,626).

What is more eyebrow-raising is the focal length parameters obtained. Neither (17837,17846) nor (39925,3526) seem plausible for the focal length pair. As a rule of thumb, the fx parameter should match the pixel width (in this case 1920) to within a factor of 2x (e.g. the iPhone 5S has fx ~= 0.8*pixelWidth). And fy should match fx to within a factor of 1.2x or so. For case 1, fx is off of the width by a factor of 10x, and for case 2 fx and fy mismatch by 10x.

I recommend trying several calibration toolboxes and look for consensus between any two of them (like asking multiple mechanics to look at your car). I recommend Jean-Yves Bouguet's calibration toolbox, which was a precursor to OpenCV's approach.

3
bugvig_pk On

If you still have access to the camera, I would say try to capture more images and repeat the calibration procedure multiple times.

As mentioned in @willem 's answer using Jean-Yves' Toolbox would let you visualize the corner detections, 3d location of the boards and help you throw away noisy images. But, Jean-Yves' Toolbox works only on checkerboards and one needs to manually input the ROI which has the squares.

If you feel that the aruco board is not giving high accuracy, you can try the Charuco board too in opencv.

I would say focal length in mm is hard to relate to the pixel focal length, because to do so you would need the size of the imager of the camera. This is not available usually.