Ask Your Question
1

Camera calibration tutorial: assertion failed

asked Nov 10 '14

gtu gravatar image

updated Nov 14 '14

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, 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!

Preview: (hide)

Comments

no one knows that?

gtu gravatar imagegtu (Nov 13 '14)edit

1 answer

Sort by » oldest newest most voted
1

answered May 26 '15

stillNovice gravatar image

Hi there, I just came across this issue and after serious web trawling, found the answer.

you need to go to your visual studio project settings, to c/c++, to code generation and change the runtime library to Multi-threaded Debug DLL (/MDd).

It seems this error is from a single threaded DLL trying to run in a multi thread project.

good luck.

Preview: (hide)

Comments

OK, that actually helped! Didn't expect such easy solution. Thanks.

gtusar gravatar imagegtusar (May 28 '15)edit

what can I do if my configuration has been like that?

timial gravatar imagetimial (Jan 21 '16)edit

Question Tools

Stats

Asked: Nov 10 '14

Seen: 1,978 times

Last updated: May 26 '15