Robotics StackExchange | Archived questions

Opencv 3.0 Assertion failed

After roslaunch monocularposeestimator demo.launch

OpenCV Error: Assertion failed (CV_IS_MAT(_cameraMatrix) && _cameraMatrix->rows == 3 && _cameraMatrix->cols == 3) in cvUndistortPoints, file /home/tuuzdu/tmp/opencv-3.0.0/modules/imgproc/src/undistort.cpp, line 288
terminate called after throwing an instance of 'cv::Exception'
what(): /home/tuuzdu/tmp/opencv-3.0.0/modules/imgproc/src/undistort.cpp:288: error: (-215) CV_IS_MAT(_cameraMatrix) && _cameraMatrix->rows == 3 && _cameraMatrix->cols == 3 in function cvUndistortPoints

What is mean CV_IS_MAT?

Asked by tuuzdu on 2015-07-31 04:43:13 UTC

Comments

Did you solve this issue? I am getting the exact same error, when I use : cv2.undistortPoints(src_norm_mat, dst_norm_mat, cameraMatrix, distCoeffs, Mat, newCameraMatrix)

cameraMatrix is 3x3. But I have save as a numpy array.

Asked by vivekp on 2016-06-06 08:58:28 UTC

Answers

This is rather a question for answers.opencv.org.

But CV_IS_MAT sounds like a test if the object you passed in is of type cv::Mat. How do you call the function and what is the size of your _cameraMatrix? Is it a 3x3 Matrix?

Asked by NEngelhard on 2015-07-31 10:54:23 UTC

Comments

It calls like trackable_object_.camera_matrix_K_ = cv::Mat(3, 3, CV_64F); I rewrite undistort.cpp with CV_Assert( CV_IS_MAT(_cameraMatrix) ); and with CV_Assert( _cameraMatrix->rows == 3 && _cameraMatrix->cols == 3 ); I got "Assertion failed" only with CV_IS_MAT(_cameraMatrix)

Asked by tuuzdu on 2015-07-31 12:00:28 UTC