cv::calibrateCamera fails to start optimization at all with some input images (Bug #592)
Description
The problem occurs in cvLevMarqu.updateALT at the line containing change = cvNorm(param, prevParam, CV_RELATIVE_L2)) < criteria.epsilon
For some reason (I could not find out in 8hrs debugging), param and prevParam are sometimes identical, causing the iteration to stop prematurely. In one case with 21 chessboard input images (enclosed), it even stopped without any iteration at all. Removing an arbitrary one of the images let the iteration start. However, testing a lot of calibration sequences showed that every now and then iterations stop prematurely because of param prevparam.
I made a log of the input parameters to the attached file, however did not test, whether it would be possible to reproduce the case by reading them and calling calibrateCamera in a small test case. Flag settings are not recorded in the file. They are CV_CALIB_FIX_ASPECT_RATIO + CV_CALIB_FIX_K3 + CV_CALIB_ZERO_TANGENT_DIST.
I have made a workaround by adding &&(change != 0) to the expression in a local copy of cvcalibration.exe. But since I do not understand how the paramprevparam condition occurs this may not cure the underlying problem.
Associated revisions
Merge pull request #592 from vpisarev:c2cpp_calib3d_ptsetreg
History
Updated by Victor Eruhimov over 14 years ago
Hi, could you please provide the source code that reproduces the problem? Thanks, Victor
Updated by Vadim Pisarevsky over 14 years ago
what compiler and what OS are you using? I played with both of your datasets on my machine (MacOSX 10.6, Xcode 3.2.4, GCC 4.2, 64-bit code) and with or without the extra check for "change != 0" I got absolutely the same calibration results. Some compilers are known to produce incorrect code for certain OpenCV functions, and since camera calibration is rounding-error-sensitive algorithm, you might get bad behaviour because of the compiler.
Updated by Vadim Pisarevsky over 14 years ago
- Status deleted (
Open)
Updated by Vadim Pisarevsky almost 14 years ago
- Status set to Done
- (deleted custom field) set to obsolete