Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Camera calibration tutorial: assertion failed

Hi, I am developing an algorithm which measures dimensions of an object. I noticed that measurement error rises when moving out of image center. So I decided to calibrate my camera. I came across this tutorial.

The code I used is the same as in the tutorial AND in the openCV sample code directory (opencv\sources\samples\cpp\tutorial_code\calib3d\camera_calibration).

The program finds all needed files - the configuration file, list of image names, images. So that is not the problem.

When I run it, it throws an error:

Debug Assertion Failed!

Program: ---udio
2013\Projects\..\Debug\Calibration.exe
File: f:\dd\vctools\crt\crtw32\misc\dbgheap.c
Line: 1424

Expression: _pFirstBlock==pHead

For information on how your program can cause an assertion failure, see the VisaulC++ documentation on asserts.

The error seems to happen in the following statement:

  if (mode == CAPTURING)
        {
            if (s.showUndistorsed)
  (here)->      msg = format("%d/%d Undist", (int)imagePoints.size(), s.nrFrames);
            else
                msg = format("%d/%d", (int)imagePoints.size(), s.nrFrames);
        }

But it finds chessboard edges thou! image description

Then I commented it and the error showed up a little later.

The next thing I tried to create calibration all on my own. I wrote this program:

int main(){
Mat pic;
vector<Point2f> pointBuf;

pic = imread("images//f4.tiff");
namedWindow("Rezultat");

findChessboardCorners(pic, Size(9, 6), pointBuf);
drawChessboardCorners(pic, Size(9, 6), Mat(pointBuf),true);
imshow("Rezultat", pic);
waitKey(0);

}

And again, same thing. All functions seem to work properly, finds corners, draw them on image, shows them, only when I want to close window on waitKey(), the program throws same error again.

I am very confused. Please help.

Thank you!

Camera calibration tutorial: assertion failed

Hi, I am developing an algorithm which measures dimensions of an object. I noticed that measurement error rises when moving out of image center. So I decided to calibrate my camera. I came across this tutorial.

The code I used is the same as in the tutorial AND in the openCV sample code directory (opencv\sources\samples\cpp\tutorial_code\calib3d\camera_calibration).

The program finds all needed files - the configuration file, list of image names, images. So that is not the problem.

When I run it, it throws an error:

Debug Assertion Failed!

Program: ---udio
2013\Projects\..\Debug\Calibration.exe
File: f:\dd\vctools\crt\crtw32\misc\dbgheap.c
Line: 1424

Expression: _pFirstBlock==pHead

For information on how your program can cause an assertion failure, see the VisaulC++ documentation on asserts.

The error seems to happen in the following statement:

  if (mode == CAPTURING)
        {
            if (s.showUndistorsed)
  (here)->      msg = format("%d/%d Undist", (int)imagePoints.size(), s.nrFrames);
            else
                msg = format("%d/%d", (int)imagePoints.size(), s.nrFrames);
        }

But it finds chessboard edges thou! image description

Then I commented it and the error showed up a little later.

The next thing I tried to create calibration all on my own. I wrote this program:

int main(){
Mat pic;
vector<Point2f> pointBuf;

pic = imread("images//f4.tiff");
namedWindow("Rezultat");

findChessboardCorners(pic, Size(9, 6), pointBuf);
drawChessboardCorners(pic, Size(9, 6), Mat(pointBuf),true);
imshow("Rezultat", pic);
waitKey(0);

}

And again, same thing. All functions seem to work properly, finds corners, draw draws them on the image, shows them, only when I want to close window on waitKey(), the program throws same error again.

I am very confused. Please help.

Thank you!