opencv_contrib icon indicating copy to clipboard operation
opencv_contrib copied to clipboard

omnidir calibration fails

Open jeremysalwen opened this issue 10 years ago • 9 comments

System information (version)
  • OpenCV => homebrew 3.1.0_3 --c++11 --with-contrib --with-examples --with-tbb --with-ffmpeg
  • Operating System / Platform => OSX
  • Compiler => XCode
Detailed description

The example calibration program fails to run the calibration on test data, with an assertion failure.

OpenCV Error: Assertion failed (!objectPoints.empty() && objectPoints.type() == CV_64FC3) in computeJacobian, file /tmp/opencv3-20160827-5158-17m97re/opencv-3.1.0/opencv_contrib/modules/ccalib/src/omnidir.cpp, line 848
libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /tmp/opencv3-20160827-5158-17m97re/opencv-3.1.0/opencv_contrib/modules/ccalib/src/omnidir.cpp:848: error: (-215) !objectPoints.empty() && objectPoints.type() == CV_64FC3 in function computeJacobian

The assertion failure can be traced to the initializeCalibration function failing to select any image because all of their reprojection errors are too high: https://github.com/opencv/opencv_contrib/blob/master/modules/ccalib/src/omnidir.cpp#L707 (hardcoded limit of 100). As you can see from visually inspecting the dataset, the images are of high quality, and so the calibration should succeed. I also note that the issue is not with the chessboard detector in general, as the standard camera calibration app shows the chessboard being detected most of the time.

Steps to reproduce

compile the sample omnidir calibration app: https://github.com/opencv/opencv_contrib/blob/master/modules/ccalib/samples/omni_calibration.cpp

And run it on the example calibration dataset from the mono calibration benchmark: https://vision.cs.tum.edu/data/datasets/mono-dataset specifically the calib_wide_checkerboard1 dataset.

(note that the individual dataset download links are broken, so you need to download the complete calibration collection to get just one: http://vision.in.tum.de/mono/all_calib_sequences.zip )

jeremysalwen avatar Oct 07 '16 08:10 jeremysalwen

Hi, I am the author of omnidir calibration. When I try to reproduce your result, I found the all_calib_sequences.zip is so big. Can you send me some images that you used to calibration? Maybe you can upload it to google drive or dropbox. Thanks.

jiuerbujie avatar Oct 08 '16 08:10 jiuerbujie

I am uploading the file to google drive, I will send you a link. I should also note that I've done a little more debugging and it seems to be that the reprojection error is calculated as NaN.

jeremysalwen avatar Oct 08 '16 09:10 jeremysalwen

You can download the dataset from https://drive.google.com/open?id=0B3UWJWIiOpoMaE4tZGtsMzYxdXc

jeremysalwen avatar Oct 08 '16 09:10 jeremysalwen

OK, I will have a look.

jiuerbujie avatar Oct 08 '16 09:10 jiuerbujie

I think the bug is that the default checkerboard size is 0 instead of 1.

jeremysalwen avatar Oct 08 '16 09:10 jeremysalwen

Yes, explicitly pass -sw and -sh solve it. I may change the default size to 1

jiuerbujie avatar Oct 08 '16 10:10 jiuerbujie

Hi, I am having the same exact assertion failure. OS: Ubuntu 18.04 OpenCV: 3.4.9, compiled from source with contrib and FFMPEG and CUDA support

I am not able to solve this error, any help is appreciated.

sanatmharolkar avatar Jul 30 '20 04:07 sanatmharolkar

@sanatmharolkar , please try the latest version: 3.4.11 or 4.4.0 and a clean build. If it does not help please file a new issue with all required information: repository versions, build platform, build options, cmake output, etc.

mshabunin avatar Jul 30 '20 08:07 mshabunin

@mshabunin the issue persists after upgrading to 3.4.11. I have created a new issue here

sanatmharolkar avatar Aug 03 '20 13:08 sanatmharolkar