简体   繁体   中英

Calling cv::calibrateCamera() failed

I'm trying to get the cameraMatrix from the function cv::calibrateCamera(), actually I'm not sure if I did it right or not, my initial idea is that:

  1. Get two input images which come from the same camera.
  2. Extract all the feature points from image_1 and image_2
  3. Use cv::calibrateCamera() to get the cameraMatrix (don't know if it would work or not)

Here is my code of doing it:

calling calibrateCamera()

The compilation went through pretty well, but when I ran it, it throws an exception said:

OpenCV Error: Assertion failed (i < 0) in create, file /home/hjbolide/OpenCV-2.3.1/modules/core/src/matrix.cpp, line 1198 terminate called after throwing an instance of 'cv::Exception'
what(): /home/hjbolide/OpenCV-2.3.1/modules/core/src/matrix.cpp:1198: error: (-215) i < 0 in function create

As I said, I was just trying this method, and try to get the cameraMatrix from it. Don't know where it goes wrong. Any suggestions?

Thanks very much.

I had a similar problem. I ported a C calibration example from the Learning OpenCV book to use the C++ interface and was seeing the exact error you saw. I changed rvec and tvec to std::vector<cv::Mat> and then the calibration worked. Note that the 2.3 documentation marks both rvec and tvec as OutputArrayOfArrays.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM