仅针对旋转计算Homography Matrix

时间:2022-03-24 11:27:28

With reference to the paper I am trying to calculate the orientation of the camera with respect to a test pattern. The test pattern looks like

参考论文,我试图计算相机相对于测试图案的方向。测试模式看起来像

仅针对旋转计算Homography Matrix when the camera is viewing it perpendicular to the test pattern plain. When viewed from an unknown orientation the test pattern looks like

当相机垂直于测试图案平面观看时。从未知方向查看时,测试图案看起来像

仅针对旋转计算Homography Matrix.

I am able to calculate the angle around x (alpha) and y (beta) axis. Now i need to deskew the test pattern to get the rotation angle about z (gamma) axis (optical axis of camera) . This is to be done by rotating the test pattern image around x and y by the negative values of alpha and beta. So how to get the homography matrix only for rotation. I have gone through virtual camera rotation and the wiki link. The virtual camera rotation code produces good result but is dependent on distance of the camera from the test pattern which in my case is unknown. I tried cv::warpPerspective by passing only the rotation matrix but results were weird.

我能够计算x(alpha)和y(beta)轴周围的角度。现在我需要校正测试图案以获得绕z(伽马)轴(相机的光轴)的旋转角度。这是通过将测试图案图像围绕x和y旋转α和β的负值来完成的。那么如何将单应矩阵仅用于旋转。我已经通过虚拟相机旋转和维基链接。虚拟摄像机旋转代码产生良好的结果,但取决于摄像机距测试模式的距离,在我的情况下是未知的。我通过仅传递旋转矩阵来尝试cv :: warpPerspective,但结果很奇怪。

1 个解决方案

#1


Since your pattern lacks features breaking its symmetry, the problem can obviously be solved only up to rotations by multiple of 90 degrees and symmetries about the pattern's axes and about its center.

由于您的图案缺乏破坏其对称性的特征,因此该问题显然只能通过90度的多次旋转以及关于图案轴和其中心的对称性来解决。

With this caveat, you can do a straight forward homography estimation using the DLT algorithm, using the pattern's center and the 4 intersections between the axes and the boundary. You can arbitrarily assign these image points to points r*(0, 0), r*(1, 0), r*(0, 1), r*(-1, 0), r*(0, -1) of your pattern respectively, with r being its radius length.

有了这个警告,您可以使用DLT算法进行直接单应性估计,使用模式的中心和轴与边界之间的4个交点。您可以任意将这些图像点分配给点r *(0,0),r *(1,0),r *(0,1),r *( - 1,0),r *(0,-1)你的模式分别是r,它的半径是长度。

Once you have estimated the homography matrix H, you can just decompose it in the product R*Q of a right-triangular matrix R and your required roto-translation matrix Q. See Zhang's paper on camera calibration for the details.

一旦估算了单应矩阵H,就可以在右三角矩阵R的乘积R * Q和你所需的旋转平移矩阵Q中对其进行分解。有关详细信息,请参阅Zhang关于相机校准的论文。

#1


Since your pattern lacks features breaking its symmetry, the problem can obviously be solved only up to rotations by multiple of 90 degrees and symmetries about the pattern's axes and about its center.

由于您的图案缺乏破坏其对称性的特征,因此该问题显然只能通过90度的多次旋转以及关于图案轴和其中心的对称性来解决。

With this caveat, you can do a straight forward homography estimation using the DLT algorithm, using the pattern's center and the 4 intersections between the axes and the boundary. You can arbitrarily assign these image points to points r*(0, 0), r*(1, 0), r*(0, 1), r*(-1, 0), r*(0, -1) of your pattern respectively, with r being its radius length.

有了这个警告,您可以使用DLT算法进行直接单应性估计,使用模式的中心和轴与边界之间的4个交点。您可以任意将这些图像点分配给点r *(0,0),r *(1,0),r *(0,1),r *( - 1,0),r *(0,-1)你的模式分别是r,它的半径是长度。

Once you have estimated the homography matrix H, you can just decompose it in the product R*Q of a right-triangular matrix R and your required roto-translation matrix Q. See Zhang's paper on camera calibration for the details.

一旦估算了单应矩阵H,就可以在右三角矩阵R的乘积R * Q和你所需的旋转平移矩阵Q中对其进行分解。有关详细信息,请参阅Zhang关于相机校准的论文。