Ask Your Question

Camera callibration does not complete for my set of images.

asked 2016-12-12 11:21:20 -0500

Prototype gravatar image

updated 2016-12-13 01:58:17 -0500

I am trying to calibrate my camera using the sample code found on samples/cpp/tutorial_code/calib3d/camera_calibration/ ( the official documentation). It runs when I enter it for the image given by them, but when I run it for my images it shows no output. I have attached the images and also the data entered. Images is image description)

For this particular image , The program runs when width and height is 4 and 4 but it distorts this image even more. But clearly, it should work for 7X7. The code crashes for 7X7.

Is there anything I am missing out?

Can you please help me in solving this problem.

The data entered in the VID file is as follows

<?xml version="1.0"?>
  <!-- Number of inner corners per a item row and column. (square, circle) -->

  <!-- The size of a square in some user defined metric system (pixel, millimeter)-->

  <!-- The type of input used for camera calibration. One of: CHESSBOARD CIRCLES_GRID ASYMMETRIC_CIRCLES_GRID -->

  <!-- The input to use for calibration. 
        To use an input camera -> give the ID of the camera, like "1"
        To use an input video  -> give the path of the input video, like "/tmp/x.avi"
        To use an image list   -> give the path to the XML or YAML file containing the list of the images, like "/tmp/circles_list.xml"
  <!--  If true (non-zero) we flip the input images around the horizontal axis.-->

  <!-- Time delay between frames in case of camera. -->

  <!-- How many frames to use, for calibration. -->
  <!-- Consider only fy as a free parameter, the ratio fx/fy stays the same as in the input cameraMatrix. 
       Use or not setting. 0 - False Non-Zero - True-->
  <Calibrate_FixAspectRatio> 1 </Calibrate_FixAspectRatio>
  <!-- If true (non-zero) tangential distortion coefficients  are set to zeros and stay zero.-->
  <!-- If true (non-zero) the principal point is not changed during the global optimization.-->
  <Calibrate_FixPrincipalPointAtTheCenter> 1 </Calibrate_FixPrincipalPointAtTheCenter>

  <!-- The name of the output log file. -->
  <!-- If true (non-zero) we write to the output file the feature points.-->
  <!-- If true (non-zero) we write to the output file the extrinsic camera parameters.-->
  <!-- If true (non-zero) we show after calibration the undistorted images.-->
  <!-- If true (non-zero) will be used fisheye camera model.-->
  <!-- If true (non-zero) distortion coefficient k1 will be equals to zero.-->
  <!-- If true (non-zero) distortion coefficient k2 will be equals to zero.-->
  <!-- If true (non-zero) distortion coefficient k3 will be equals to zero.-->
  <!-- If true (non-zero) distortion coefficient k4 will be equals to zero.-->
  <!-- If true (non-zero) distortion coefficient k5 will be equals to zero.-->
edit retag flag offensive close merge delete


btw, please use rectangular grids, not a square one, whic has a problem being symmetric at 90° rotation

berak gravatar imageberak ( 2016-12-13 02:41:04 -0500 )edit

1 answer

Sort by » oldest newest most voted

answered 2016-12-12 20:17:38 -0500

Tetragramm gravatar image

You misspelled BoardSize_Height in the closing tag. The error message should have been a pretty big hint.

edit flag offensive delete link more


@Tetragramm I did that. Now the problem is the code keeps running and after a few minutes it terminates or it shows the following erro rerror: (-215) src.size == dst.size && src.channels() == dst.channels() in function cvConvertScale I gave width 7 and breadth 7. Please help me

Prototype gravatar imagePrototype ( 2016-12-13 00:55:44 -0500 )edit

@Tetragramm The image works when I enter 4X4 and not 7X7. But when I crop the image a little more, It fails.

Prototype gravatar imagePrototype ( 2016-12-13 01:53:09 -0500 )edit

You're cropping the image? You should never alter the image when doing camera calibration. Especially cropping. That just entirely defeats the point.

Tetragramm gravatar imageTetragramm ( 2016-12-13 07:15:09 -0500 )edit

Question Tools

1 follower


Asked: 2016-12-12 11:21:20 -0500

Seen: 378 times

Last updated: Dec 13 '16