Ask Your Question
1

calibrateCamera - distortion coefficients differ greatly

asked 2013-11-19 10:10:11 -0600

Marin gravatar image

I'm trying to calibrate the camera of a Blackberry Playbook tablet. To do this I shot several videos of both a chessboard and an asymmetric circles pattern. I film the pattern from different angles and sides. Using OpenCV, I find a frame that contains the pattern and then I skip a number of frames (equivalent to 0.25-1.0 seconds) for the next input. I use a total of 30 frames. This consistently gives me a reprojection error of about 0.24-0.30, which is reasonable I guess.

My problem is that when I change the amount of frames skipped or the calibration pattern the distortion coefficients change dramatically. I thought it might be caused by motion blur of the camera, but I can't really detect it with my own eyes and I do not move the camera quite gently.

What could I be doing wrong?


Here are some calibration results, taken from output .yml files written using FileStorage:

distCoeffs: [ 7.8525429419470660e-02, -3.0960261342412626e-01, 
             -8.6524434042007194e-04, -1.5106802929380169e-03,
              2.4943420525237567e-01 ]
reprojectionError: 2.5980283849938213e-01

distCoeffs: [ 9.5072469884162333e-02, -4.0909425759139262e-01,
             -1.4098479752338933e-03, -8.5000416228384647e-03,
             4.9234810766112463e-01 ]
reprojectionError: 2.9590490979407219e-01

distCoeffs: [ 8.4964364149716379e-02, -2.6207341751103475e-01,
             -4.4505493959335414e-04, -5.4369272625535434e-03,
              4.7645565934149210e-02 ]
reprojectionError: 2.4693283075662995e-01

distCoeffs: [ -2.4401111960459070e-03, 7.7251179587715735e-01,
              -3.4754734701746902e-03, -5.5816510106682163e-03,
              -3.8066475946718032e+00 ]
reprojectionError: 2.4246869857561970e-01

I call calibrateCamera a total of 4 times with the following flags (I thought this would increase the accuracy, but the results don't change between calibration passes):

flags = 0;
flags = CALIB_USE_INTRINSIC_GUESS | CALIB_FIX_PRINCIPAL_POINT;
flags = CALIB_USE_INTRINSIC_GUESS | CALIB_FIX_ASPECT_RATIO;
flags = CALIB_USE_INTRINSIC_GUESS;
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2013-11-19 11:22:25 -0600

jensenb gravatar image

Camera distortion estimation, and calibration for that matter, involves solving high dimensional non linear minimization problem that is quite sensitive to the input data. Looking at your values, I would say that they vary within a reasonable margin. In your case the radial distortion model with higher order coefficients, here you have coefficients for the r^2, r^4 and r^6 terms, is an overparametrization for the distortion of your lens. Because you can achieve similar reprojection errors with distortion parameters varying by up to an order of magnitude strongly indicates this model has too many degrees of freedom.

In general I would not worry too much about varying distortion and calibration parameters as long as the rectified image does not have visible distortion and the reprojection error remains low.

edit flag offensive delete link more

Comments

That's good to hear. I'll do some extra testing to see if the rectified image is indeed correct and accept your answer if that is the case. Thanks!

Marin gravatar imageMarin ( 2013-11-19 12:33:23 -0600 )edit

I cannot really see a difference in the undistorted output whether I use one calibration result or the other, so you were right!

Marin gravatar imageMarin ( 2013-11-20 03:16:17 -0600 )edit

The classical check for distortion is to look at straight lines in your scene (so along the checkerboard pattern), and check that they are straight in your image. The most distortion is likely occur around the four corners of your image.

jensenb gravatar imagejensenb ( 2013-11-20 09:40:03 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2013-11-19 10:10:11 -0600

Seen: 2,096 times

Last updated: Nov 19 '13