Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to use decomposeHomographyMat in OpenCV3

I did the calibration and there is the intrinsic camera calibration matrix.

FileStorage fs("out_camera_data.xml", FileStorage::READ);
Mat cameraMatrix, distCoeffs;
fs["Camera_Matrix"] >> cameraMatrix;
fs["Distortion_Coefficients"] >> distCoeffs;


Then I used SURF and there is the homography matrix.

Mat H = findHomography( obj, scene, CV_RANSAC );


Now I need to decompose Homography matrix, in OpenCV3 there is a function 'decomposeHomographyMat link text'

Mat rotations, translations, normals;
decomposeHomographyMat(H, cameraMatrix, rotations, translations, normals) ;


When I build the program, it don't have error.
But when it run, there is a problem.

OpenCV Error: Assertion failed (k == STD_VECTOR_MAT) in getMatRef
terminate called after throwing an instance of 'cv::Exception'
what(): error: (-215) k == STD_VECTOR_MAT in function getMatRef

I don't know why?
Help me, please.........