Reputation: 391
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:
Here is my code of doing it:
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.
Upvotes: 2
Views: 2607
Reputation: 71
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.
Upvotes: 5