Android: Exception in cvConvertScale, called from solvePnP
In an OpenCV4Android app, I get the following error when running Calib3d.solvePnP(MatOfPoint3f objectPoints, MatOfPoint2f imagePoints, Mat cameraMatrix, MatOfDouble distCoeffs, Mat rvec, Mat tvec)
:
FATAL EXCEPTION: Thread-183
CvException [org.opencv.core.CvException: /home/reports/ci/slave_desktop/50-SDK/opencv/modules/core/src/convert.cpp:1352: error: (-215) src.size == dst.size && src.channels() == dst.channels() in function void cvConvertScale(void const*, void*, double, double)
]
at org.opencv.calib3d.Calib3d.solvePnP_1(Native Method)
at org.opencv.calib3d.Calib3d.solvePnP(Calib3d.java:2203)
Can anyone tell me, how does solvePnP use cvConvertScale, and which arguments to solvePnP are likely to cause this exception?
My objectPoints and imagePoints matrices are Nx1 (the same size as each other). My cameraMatrix is 3x3. My distCoeffs is 4x1 and contains all zeroes. My rvec and tvec are newly instantiated MatOfFloat objects.
If any more information would be helpful, please let me know. Thanks!
Nevermind, I solved the issue. I had a bug where I was resizing cameraMatrix improperly. As described above, though, 3x3 is the correct size.