简体   繁体   English

在findHomography()中获得的矩阵的同构分解

[英]Homography decomposition of the matrix obtained in findHomography()

I have used this code as a basis to detect my rectangular target in a scene. 我已使用此代码作为基础来检测场景中的矩形目标。 I use ORB and Flann Matcher. 我使用ORB和Flann Matcher。 I have been able to draw the bounding box of the detected target in my scene successfully using the findHomography() and perspectiveTransform() functions. 我已经能够使用findHomography()perspectiveTransform()函数成功绘制场景中检测到的目标的边界框。
The reference image ( img_object in the above code) is a straight view of only the rectangular target. 参考图像(以上代码中的img_object )是仅矩形目标的直视图。 Now the target in my scene image may be tilted forwards or backwards. 现在,我的场景图像中的目标可能会向前或向后倾斜。 I want to find out the angle by which it has been tilted. 我想找出它倾斜的角度。 I have read various posts and came to the conclusion that the homography returned by findHomography() can be decomposed to the rotation matrix and translation vector. 我阅读了各种文章,得出的结论是, findHomography()返回的单应性可以分解为旋转矩阵和平移向量。 I have used code from https:/gist.github.com/inspirit/740979 recommended by this link translated to C++. 我使用了https://gist.github.com/inspirit/740979的代码, 此链接将其推荐为C ++。 This is the Zhang SVD decomposition code got from the camera calibration module of OpenCV. 这是从OpenCV的摄像机校准模块获得的Zhang SVD分解代码。 I got the complete explanation of this decomposition code from O'Reilly's Learning OpenCV book. 我从O'Reilly的Learning OpenCV一书中获得了有关此分解代码的完整说明。
My questions are : 我的问题是:

  1. Am I correct in assuming that the decomposed rotation matrix I get will tell me the angle at which my target has been tilted? 我以为我得到的分解后的旋转矩阵会告诉我目标倾斜的角度是否正确?
  2. Secondly can I use the Homography obtained from findHomography() in as input to this decomposition module and expect the correct output? 其次,我可以使用从findHomography()获得的findHomography()作为该分解模块的输入,并期望正确的输出吗? Or is there something I am missing? 还是我想念的东西?
  3. Is there any other way I can achieve the same? 我还有其他方法可以实现相同目标吗?

Lastly, I am coding on a mobile platform so I am concerned about the performance too. 最后,我在移动平台上编码,因此我也担心性能。 I would be glad if you can point me in the right direction. 如果您能指出正确的方向,我将非常高兴。

Thanks in advance for your time and replies. 在此先感谢您的时间和答复。

Zhang's calibration procedure will produce a rotation matrix. 张的校准程序将产生一个旋转矩阵。 That's representable as 3 (Euler) angles, not one. 这可以表示为3个(欧拉角),而不是一个。 Or, equivalently (via Rodriguez's formula), as one unit vector and an angle of rotation about that vector - ie three numbers again. 或者,等效地(通过Rodriguez公式),作为一个单位矢量和围绕该矢量的旋转角度-即再次为三个数字。

Unless your camera and target are very carefully positioned with respect to each other, there is no reason to expect that there be just one non-zero angle of rotation. 除非您的相机和目标彼此非常小心地放置,否则没有理由期望只有一个非零的旋转角度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM