Ask Your Question

Hard to calibrate long focal length lens, result is very poor [closed]

asked 2017-09-29 22:55:07 -0600

MonyChin gravatar image

Hi! I use a long focal length lens(1920 x 1080P, about 96mm focal length, field of view of 4°) and falt calibration sheet(chessboard) for calibration, retry many times, but result had very high error. If you have a few good approaches, please give some suggestions to me , thank you!

edit retag flag offensive reopen merge delete

Closed for the following reason not a real question by MonyChin
close date 2017-10-18 03:29:38.419049


You mention in a comment later that you are using a variable zoom lens. The calibration is heavily zoom dependent. 'fx' and 'fy', commonly referred to as focal length are really unit conversions from world-space units to pixel-space units and don't have a simple relationship to lens focal length. Any adjustment to the lens zoom or to the lens focus, for a lens that can be approximated by the thin lens equation, will change the camera intrinsic parameters and require recalibration.

ben-rambam gravatar imageben-rambam ( 2018-07-27 07:39:49 -0600 )edit

2 answers

Sort by » oldest newest most voted

answered 2017-10-18 03:27:43 -0600

MonyChin gravatar image

When I did many kinds of attempts under opencv, but still can't resolve it, I tried to get other solution. After I use matlab, I found it done.

I compare the imagepoints from opencv and matlab, they are different, I think they should maybe used different algorithms for checkerboard detection, and different algorithm to optimization(maybe Levenberg-Marquardt non-linear least squares algorithm and gradient descent algorithm).

Attached matlab sample code by Matlab software:

% Define images to process

imageFileNames1 = {'F:\CaptureFiles\left1.bmp',...

imageFileNames2 = {'F:\CaptureFiles\right1.bmp',...

% Detect checkerboards in images

[imagePoints, boardSize, imagesUsed] = detectCheckerboardPoints(imageFileNames1, imageFileNames2);

% Generate world coordinates of the checkerboard keypoints

squareSize = 50;  % in units of 'mm'

worldPoints = generateCheckerboardPoints(boardSize, squareSize);

% Calibrate the camera

[stereoParams, pairsUsed, estimationErrors] = estimateCameraParameters(imagePoints, worldPoints, ...
    'EstimateSkew', false, 'EstimateTangentialDistortion', false, ...
    'NumRadialDistortionCoefficients', 2, 'WorldUnits', 'mm', ...
    'InitialIntrinsicMatrix', [], 'InitialRadialDistortion', []);
edit flag offensive delete link more

answered 2017-09-30 10:34:40 -0600

Tetragramm gravatar image

updated 2017-09-30 10:38:06 -0600

I suggest using an ARUCO chessboard (ChARUCO). That gives you a bit of tolerance if you slide out of the field of view, so you get more good frames.

Also, if you are using a lens labelled 92mm, but your camera focal plane is not the standard size (whatever that is for your lens), then the Effective Focal Length (EFL) will be different, as will the FoV.

And make sure to use lots of images that thoroughly cover the camera area, at many different angles. If they are all close to the same angle to the camera (ie, parallel to the focal plane) then you'll get worse results.

edit flag offensive delete link more


Thank you for your answer, and I'd be sorry that I didn't make my question clear. I use a zoom camera(support 30 times optical zoom, focal 4.7mm to 141mm). Below 20mm focal, calibration is done with chessboard within 4m far away from camera, and calibration result is good. When I use 94mm focal to calibration, I put the chessboard 18m far away from camera, repeat many times always fail, calibration result is very poor, for example, extrinsic parameters show chessboard at the Z-axis of 19.2m, and fx/fy is imprecise. Dose anyone had done calibration under long focal length lens? And I saw a related web page by accident:, but I still have no idea how to solve it.

MonyChin gravatar imageMonyChin ( 2017-10-10 07:38:00 -0600 )edit

How precise are your measurements of the printed chessboard? The actual physical dimensions? If your board is printed at 1 and 7/8 inches instead of the typical 2 inches, that would be enough to account for your error.

Tetragramm gravatar imageTetragramm ( 2017-10-10 17:37:30 -0600 )edit

I tried different size chessboard, such as 40mm square printed on paper, and 20mm square printed on glass.

Images are as below:


MonyChin gravatar imageMonyChin ( 2017-10-10 20:30:41 -0600 )edit

Ah, but is that 40mm +/- 2mm, or is that 40mm +/- 0.1mm? A 2mm error is more than enough to cause the difference you are seeing. I suggest carefully measuring the actual size of the squares and modifying your objectPoints accordingly. Or at least verifying that you have the numbers correct.

Tetragramm gravatar imageTetragramm ( 2017-10-10 20:46:15 -0600 )edit

Follow your advice, I redesigned chessboard with 50mm*50mm size of squares printed with high-precision laser printer.

For comparison, I use two cameras of the same type, let them all at 20x optical zoom and manual focus at chessboard until image clear. And then simultaneously take photos contains chessboard.

First, I calibration two cameras respectively, but they both has imprecise calibration result. Extrinsic parameters show the same chessboard is about 16.7 meters away from the left camera, and about 16.6 meters away from the right camera, but actually it should be about 17 meters.

MonyChin gravatar imageMonyChin ( 2017-10-12 09:46:05 -0600 )edit

Second, because of the calibration error, when I continue to do stereo calibration, caused the translation vector between the coordinate systems of the cameras is not exactly right, tx(70.4mm),ty(0.7mm) is right, but tz(126mm) obvious error. The two cameras are almost in parallel (see

How should I do to improve calibration precision?

Thank you!

Attach the download address of the photos taken:

MonyChin gravatar imageMonyChin ( 2017-10-12 09:46:17 -0600 )edit

Following are the calibration result:

M1: !!opencv-matrix data: [ 2.7404525176905558e+04, 0., 6.6217232291105267e+02, 0., 2.7594292059815831e+04, 7.1486228436080671e+02, 0., 0., 1. ]

D1: !!opencv-matrix data: [ 3.4819864469451902e+00, -3.6157525037153897e+02, 1.3496123350562690e-02, -1.9416002384541879e-02, 0. ]

M2: !!opencv-matrix rows: 3 cols: 3 dt: d data: [ 2.7361508771302761e+04, 0., 7.0586907667558455e+02, 0., 2.7386113898024854e+04, 6.4029269238121265e+02, 0., 0., 1. ]

D2: !!opencv-matrix data: [ 4.2375130981481366e+00, -1.9007843958148979e+02, 1.4513903214895376e-02, -2.1378625230708086e-02, 0. ]

MonyChin gravatar imageMonyChin ( 2017-10-12 09:47:00 -0600 )edit

R: !!opencv-matrix data: [ 9.9994154441377203e-01, -1.0810799611721444e-02, 1.8538380603080309e-04, 1.0810334189519450e-02, 9.9993880376403588e-01, 2.3506172933415643e-03, -2.1078451376182745e-04, -2.3484758257331663e-03, 9.9999722011172842e-01 ]

T: !!opencv-matrix data: [ -7.0483363583829288e+01, 7.8713348469688715e-01, -1.2626793317750000e+02 ]

MonyChin gravatar imageMonyChin ( 2017-10-12 09:47:14 -0600 )edit

Question Tools

1 follower


Asked: 2017-09-29 22:55:07 -0600

Seen: 1,554 times

Last updated: Oct 18 '17