How to use decomposeHomographyMat in OpenCV3

asked 2016-01-03 08:20:25 -0600

nistar gravatar image

I did the calibration and there is the intrinsic camera calibration matrix 'K'.
Then I used SURF and there is the homography matrix 'H'.

Now I need to decompose Homography matrix, in OpenCV3 there is a function 'decomposeHomographyMat'
int cv::decomposeHomographyMat(InputArray H, InputArray K, OutputArrayOfArrays rotations, OutputArrayOfArrays translations, OutputArrayOfArrays normals )

I write:

Mat rotations, translations, normals;
decomposeHomographyMat(H, K, 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, file/home/lwc-pc/opencv-3.1.0/modules/core/src/matrix.cpp, line 2667 terminate called after throwing an instance of 'cv::Exception' what(): /home/lwc-pc/opencv-3.1.0/modules/core/src/matrix.cpp:2667: error: (-215) k == STD_VECTOR_MAT in function getMatRef

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

edit retag flag offensive close merge delete

Comments

1

looking at the docs and your errormsg, i'd guess it is:

Mat H,K = ...
vector<Mat> rotations, translations, normals;
decomposeHomographyMat(H, K, rotations, translations, normals) ;
berak gravatar imageberak ( 2016-01-03 08:27:04 -0600 )edit

It's great, thanks a lot

nistar gravatar imagenistar ( 2016-01-03 08:34:03 -0600 )edit

There is more question.
When the program run, there are 4 value of rotations.
Which one is the correct value?

And I need the rotation angle for the camera plane.
How to do it?

nistar gravatar imagenistar ( 2016-01-03 11:43:47 -0600 )edit

@nistar, what library u included in your decomposition code . i m getting error while compiling the code

Himanshus gravatar imageHimanshus ( 2016-01-25 01:14:57 -0600 )edit