First off, I hope this is the correct Stack Exchange board. My apologies if it is not.

I am working on something that requires me to calibrate the camera. I have successfully implemented the code to do this in OpenCV (C++). I am using the inbuilt chessboard functions and a chessboard I have printed off.

There are many tutorials on the internet which state to give more than one view of the chessboard and extract the corners from each frame.

Is there an optimum set of views to give to the function to get the most accurate camera calibration? What affects the accuracy of the calibration?

For instance, if I give it 5 images of the same view without moving anything it gives some straight results when I try and undistort the webcam feed.

FYI to anyone visiting: I've recently found out you can get must better camera calibration by using a grid of asymmetric circles and the respective OpenCV function.

  • $\begingroup$ I would like to ask a related question as I am working on something similar. I want to mount a camera on the top of a car to detect objects on the road. In which cases do you need to repeat camera calibration? Only if I change my lens‘ focal length or if I change the camera‘s position and angle? Thank you in advance. $\endgroup$
    – Paul Wolff
    Commented Jan 23, 2021 at 18:26
  • $\begingroup$ Asymmetrical circle grids are not generally better. Circle targets can potentially yield very accurate feature point detection as many boundary pixels contribute. However, beware of the perspective and distortion bias - circles are imaged as distorted ellipses in the image. The ellipse center is not the center of the circle. OpenCV's detector uses simple blob-detection and certainly doesn't correct for these biases. Your experience is probably explained by other factors. $\endgroup$
    – Jakob
    Commented Jun 20, 2022 at 9:22

6 Answers 6


You have to take images for calibration from different points of view and angles, with as big difference between angles as possible (all three Euler angles should vary), but so that pattern diameter was still fitting to camera field of view. The more views are you using the better calibration will be. That is needed because during the calibration you detect focal length and distortion parameters, so to get them by least square method different angles are needed. If you arn't moving camera at all you are not getting new information and calibration is useless. Be aware, that you usually need only focal length, distortion parameters are usually negligible even for consumer cameras, web cameras and cell phone cameras. If you already know focal length from the camera specification you may not even need calibration.

Distortion coefficient are more present in "special" cameras like wide-angle or 360°.

Here is the Wikipedia entry about calibration. And here is non-linear distortion, which is negligible for most cameras.

  • $\begingroup$ By Eulers angles I assume you mean rotating the camera around the chessboard (with the chessboard as pivot) in the x, y and moving the camera towards and away from the chessboard in the z? I read about someone who simply printed off transformed chessboards and keeping the camera in the same place. For instance: i.imgur.com/rYzV4.png and i.imgur.com/McG9z.png. Is using things like this a poor decision as it may not represent how things would distory in reality? $\endgroup$
    – Cheetah
    Commented Feb 27, 2012 at 17:01
  • $\begingroup$ Yes about moving camera. Yes again about keeping in place. $\endgroup$ Commented Feb 28, 2012 at 7:55
  • $\begingroup$ @mirror2image You mean, in practical operations, it's better to change different angles. But that means different views will have different world coordination systems. Do I need to use a shared world coordination system to keep the object points in the same coordination system? $\endgroup$
    – Chao
    Commented Sep 11, 2017 at 5:44
  • $\begingroup$ I disagree with two things: a) all three Euler angles do not need to be varied. Rotation around the optical axis does generally not constraint any of the model parameters. Foreshortening is important for focal length estimation but must be weighted against potential detection bias as higher foreshortening angles. b) distortion parameters are nearly always important even for high quality lenses - but this is application specific of course. $\endgroup$
    – Jakob
    Commented Jun 20, 2022 at 9:19

I decided to post this answer here because a while back, this came up as the top result in Google and its suggestions helped me. So I decided to share my experience too.

Having spent countless hours trying to get the best stereo calibration on a Kinect, I shared my tips and findings in a blog post here.

Although it is geared towards stereo calibration and more specifically Kinect, I believe the tips will help anyone who is trying to calibrate a camera.

Also, in case I should die someday or forget to renew my hosting, here is a modified quote from the post:

  1. Make sure you have the largest possible calibration pattern. Follow what I said above. Get a nice pattern professionally printed. Make sure each square is at least 8cm x 8cm. Also, make sure one side of the calibration pattern has an odd number of squares and the other side has an even number of squares (e.g 9×6 or 7×8). It’s important for detecting the pose of the target correctly. Also, some toolboxes will not be able to detect the pattern if this requirement is not met. As mentioned before, the patterns I used which are suitable for printing on large sheets are uploaded here (for 9cm squares) and here (for 10cm squares).
  2. Make sure your printed pattern has enough white border around it, otherwise it may not be easily detected by most toolboxes.
  3. Make sure the Kinect does not move. I mounted in on a tripod.
  4. Try to get as many images of the calibration target as you can. My best calibration was obtained using 300 images, at distances as low as 0.5 meter to as far as 10 meters from the camera. Make sure you rotate the pattern around X, Y and Z axes. Also try to “tile” the view with images taken at the same distance: i.e take one image, move the target to the next tile in the field of view, take another one and repeat until you’ve “tiled” all of the current field of view. The goal is to cover the entire field of view at each distance as much as possible.
  5. Use MATLAB’s stereo calibration app if possible. It allows you to get rid of the outliers after each calibration phase.

Update 2020:
It's almost 3 years after all this. A couple of years of industry experience has taught me something new: if your task heavily relies on the correctness of camera calibration, consider building a quick UI that allows you to manually fine-tune extrinsic/intrinsics and see immediate visual results. This way, you can focus on other parts of your system while not having to think about how bad camera calibration is affecting you. Once everything is ready, you can decide on the best method to calibrate your cameras with.


Here is a list of 'best practices' for camera calibration which I originally posted here: https://calib.io/blogs/knowledge-base/calibration-best-practices

  • Choose the right size calibration target. Large enough to properly constrain parameters. Preferably it should cover approx. half of the total area when seen fronto-parallel in the camera images.
  • Perform calibration at the approximate working distance (WD) of your final application. The camera should be focused at this distance and focus should be unchanged after calibration.
  • The target should have a high feature count. Using fine patterns is preferable. However, at some point detection robustness suffers. Our recommendation is to use fine pattern counts for cameras above 3MPx and if the lighting is controlled and good.
  • Collect images from different areas and tilts. Move the target to fully cover the image area and aim for even coverage. Lens distortion can be properly determined from fronto-parallel images only, but focal length estimation is dependent on observing foreshortening. Include both frontoparallel images, and images taken with the board tilted up to +/- 45 degrees in both horizontal an vertical direction. Tilting more is usually not a good idea as feature localization accuracy suffers.
  • Use good lighting. This is often overlooked, but hugely important. The calibration target should preferably be diffusely lit by means of controlled photography lighting. Strong point sources give rise to uneven illumination, possibly making detection fail, and not utilizing the camera's dynamic range very well. Shadows can do the same.
  • Have enough observations. Usually, calibration should be performed on at least 6 observations (images) of a calibration target. If a higher order camera or distortion model is used, more observations are beneficial.
  • Consider using uniquely coded targets such as CharuCo boards. These allow you to gather observations from the very edges of the camera sensor and lens, and hence constrain the distortion parameters very well. Also, they allow you to collect data even when single feature points do not fulfill the other requirements.
  • Calibration is only as accurate as the calibration target used. Use laser printed targets only to validate and test.
  • Proper mounting of calibration target and camera. In order to minimize distortion and bow in larger targets, mount them either vertically, or laying flat on a rigid support. Consider moving the camera in these cases instead. Use a quality tripod, and avoid touching the camera during acquisitions.
  • Remove bad observations. Carefully inspect reprojection errors. Both per-view and per-feature. If any of these appear as outliers, exclude them and recalibrate.

An online tool to generate PDFs for calibration targets is found here: https://calib.io/pages/camera-calibration-pattern-generator

  • $\begingroup$ Hi, welcome to DSP SE. Self-promoting answers are generally not welcome here. Please consider making it higher quality answer. $\endgroup$
    – jojeck
    Commented Oct 25, 2018 at 10:30

@Ben - number of views depends the camera and the final accuracy required.

With very high quality, low distortion lenses (high-end 35mm SLR) using lots of chessboard images to map the distortions can be unstable - since the distortions are fractions of a pixel.
You still need several shots with the board (or camera) rotated since the image centre is normally only within a couple of pixels of the nominal x/2,y/2 and will change with focus. And of course zoom changes everything.

Once you have lens-chip centre and focal length(in X and Y) you only need a single chess board in the shot to give you camera position

  • $\begingroup$ I keep getting really bad calibration and I honestly can't figure out why. I have a printed chessboard on the wall and I am moving the camera to different positions so it has different views on the chessboard but whenever I use the undistort function in opencv and it just comes out very weird and distorted compared to the original. My camera is a Microsoft LifeCam Studio 1080p. $\endgroup$
    – Cheetah
    Commented Mar 12, 2012 at 12:18
  • $\begingroup$ @Ben Disable any autofocus. On tiny lens webcams the focal length and lens centre change with focus. Are you rotating enough that it gets a good fit for the centre? Do have squares going out to the corners? Finally check that all the targets have all the squares detected. $\endgroup$ Commented Mar 12, 2012 at 16:07
  • $\begingroup$ The autofocus has already been disabled. Define enough? I am trying as extreme angles as I can to pick up the points. Not sure what you mean by "squares going out to the corners", if you mean the function which draws the extracted corners on the image - then yes. I already also have the check to see that all the corners have been detected. I think my problem MAY lie with what I set the initial focal length to in the intrinsic matrix that I pass to the calibration function. I have tried 1:1, 16:9 (what I believe the webcam aspect ratio is) and have also tried NOTHING (which you can do) $\endgroup$
    – Cheetah
    Commented Mar 12, 2012 at 16:20
  • $\begingroup$ @Martin Is it possible to do calibration by keeping the camera at stationery position and changing the chessboard orientation without changing the distance between the camera and chessboard?? $\endgroup$
    – user4059
    Commented Mar 4, 2013 at 4:15
  • $\begingroup$ @Santosh - yes that's obviously exactly equivalent. You need to make sure you have covered lots of different angles $\endgroup$ Commented Mar 4, 2013 at 5:35

The approach described in details here: https://discorpy.readthedocs.io/en/latest/usage/demo_06.html can give sub-pixel accuracy and only needs a single calibration image. It use a different model compared to the one used by opencv: https://discorpy.readthedocs.io/en/latest/tutorials/methods.html


Please check this article about camera calibration for dash camera of moving car dash camera - it uses optical flow and few tricks with use of least square optimization over optical flow to detect car direction of movement, by finding the point where optical flow vector intersecting.

Code too complex here, so you can find all math code in the article bellow.


  • $\begingroup$ Please refrain from posting answers that are completely based on linked resources. Provide at least a brief description and explanation of what the resources contain so that the OP can decide whether they are relevant or not and facilitate future reference. Furthermore, if the links you provide go dead then your answer is completely invalidated. $\endgroup$
    – ZaellixA
    Commented Feb 6 at 11:15
  • $\begingroup$ It looks like you're the author of the article. That should be clearly noted in the post to avoid triggering spam rules $\endgroup$ Commented Mar 7 at 14:17
  • $\begingroup$ dsp.stackexchange.com/help/promotion $\endgroup$ Commented Mar 7 at 14:18
  • $\begingroup$ Just to be clear, I'm not trying to be negative. I really like the approach you propose in your post and I think you should proudly attach your name to it. One technical concern though: it's critical that the intrinsic calibration of your camera be good, and the images rectified (or flow data pre-processed). Otherwise you will get biased angles, with error increasing towards the corners of the image. $\endgroup$ Commented Mar 7 at 15:10
  • $\begingroup$ For a fully symmetrical image, the biases might cancel out, but since your image tends to have strong vertical asymmetry, your pitch angle will be inaccurate without rectification $\endgroup$ Commented Mar 7 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.