Converting between AprilCal and OpenCV

I recently wanted to use AprilCal from the April Robotics Toolkit‘s camera suite for camera calibration but to write my code in OpenCV. I got a bit stuck converting between formats so Andrew Richardson helped me out.

1) Run AprilCal’s calibration.

2) Enter the GUI’s command line mode and export to a bunch of different model formats with :model-selection

3) Find the file for CaltechCalibration,kclength=3.config which orders the distortion paramters like this: radial_1, radial_2, tangential_1, tangential_2, radial_3.

4) Your OpenCV camera matrix is:

        [  fc[0]   0     cc[0]  ]
    M = [    0   fc[1]   cc[1]  ]
        [    0     0       1    ]

5) Your OpenCV distortion vector is:

      kc[0]  
      kc[1]  
D =   lc[0]  
      lc[1]  
      kc[2]  

08/13/14