Assertion failed CV_Assert( CV_IS_MAT(objectPoints) && CV_IS_MAT(imagePoints) && CV_IS_MAT(A) && CV_IS_MAT(rvec) && CV_IS_MAT(tvec) )

0

I've calibrated a camera and obtained 0.17 reprojection error, the file is saved as camera.yml. Then, I imported this file to my aruco detection algorithm and when I run this algorithm, everything starts out fine until an aruco marker is detected, however, the moment an aruco marker is detected, the code throws the following error and stops running.

cv exception: OpenCV(3.4.2) error: (-215:Assertion failed) (((objectPoints) != __null && (((const CvMat*)(objectPoints))->type & 0xFFFF0000) == 0x42420000 && ((const CvMat*)(objectPoints))->cols > 0 && ((const CvMat*)(objectPoints))->rows > 0) && ((const CvMat*)(objectPoints))->data.ptr != __null) && (((imagePoints) != __null && (((const CvMat*)(imagePoints))->type & 0xFFFF0000) == 0x42420000 && ((const CvMat*)(imagePoints))->cols > 0 && ((const CvMat*)(imagePoints))->rows > 0) && ((const CvMat*)(imagePoints))->data.ptr != __null) && (((A) != __null && (((const CvMat*)(A))->type & 0xFFFF0000) == 0x42420000 && ((const CvMat*)(A))->cols > 0 && ((const CvMat*)(A))->rows > 0) && ((const CvMat*)(A))->data.ptr != __null) && (((rvec) != __null && (((const CvMat*)(rvec))->type & 0xFFFF0000) == 0x42420000 && ((const CvMat*)(rvec))->cols > 0 && ((const CvMat*)(rvec))->rows > 0) && ((const CvMat*)(rvec))->data.ptr != __null) && (((tvec) != __null && (((const CvMat*)(tvec))->type & 0xFFFF0000) == 0x42420000 && ((const CvMat*)(tvec))->cols > 0 && ((const CvMat*)(tvec))->rows > 0) && ((const CvMat*)(tvec))->data.ptr != __null) in function 'cvFindExtrinsicCameraParams2'

The error is caused by

CV_Assert( CV_IS_MAT(objectPoints) && CV_IS_MAT(imagePoints) && CV_IS_MAT(A) && CV_IS_MAT(rvec) && CV_IS_MAT(tvec) );

that can be found in opencv/modules/calib3d/src/calibration.cpp, line #996 (https://github.com/opencv/opencv/blob/3.4/modules/calib3d/src/calibration.cpp).

I know that Rvecs and TVecs are generated with the help of calibration file. It looks like something in the calibration isn’t in the right format.

I have a sample calibration file (sample.yml) that belongs to another camera. When I import that file while running the aruco detection algorithm, it runs without any errors.

The contents of these files (in case you want to compare them) are available here:

I'm using OpenCV 3.4.2.

c++
opencv
camera-calibration
aruco
asked on Stack Overflow Aug 29, 2019 by csg • edited Aug 30, 2019 by csg

1 Answer

1

The entire problem is the discrepancy in the naming conventions between the two files. I copied the names from sample.yml to camera.yml and it started working. Sometimes the solution is that simple.

answered on Stack Overflow Aug 31, 2019 by csg

User contributions licensed under CC BY-SA 3.0