透视矩阵的旋转角度 [英] rotation angle of the perspective matrix
本文介绍了透视矩阵的旋转角度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从透视矩阵中检测旋转角度?
How can I detect the rotation angle from a perspective matrix?
我写了这段代码,但是结果角度不超过40 ...
I wrote this code ,but the resulted angle doesn't exceed 40 ...
Mat mmat;
mmat.create(3,3,CV_32FC1);
mmat=getPerspectiveTransform(templPoints,imgPoints);
cout<< mmat<<endl<<endl;
float angle=acos(mmat.at<double>(0,0));
angle=(angle*180)/3.14;
cout<<"angle is"<<angle<<endl;
推荐答案
getPerspectiveTransform返回单应性矩阵,该矩阵可以按如下方式分解:
getPerspectiveTransform returns an homography matrix which can be decomposed like this:
[R11,R12,T1]
[R11,R12,T1]
[R21,R22,T2]
[R21,R22,T2]
[P,P,1]
R代表旋转矩阵,T代表平移,P代表透视变形.
R represents a rotation matrix, T represents a translation, and P represents a perspective warp.
有关旋转矩阵代表的更多信息:
More info on what rotation matrix represents:
http://en.wikipedia.org/wiki/Rotation_matrix
http://mathworld.wolfram.com/RotationMatrix.html
这篇关于透视矩阵的旋转角度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文