发现单体和扭曲的观点 [英] Finding Homography And Warping Perspective

查看:250
本文介绍了发现单体和扭曲的观点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用FeatureDetector我获得两个图像的功能与相同的元素,并匹配此功能与BruteForceMatcher。
然后我使用OpenCv函数findHomography获取单应性矩阵

With FeatureDetector I get features on two images with the same element and match this features with BruteForceMatcher. Then I'm using OpenCv function findHomography to get homography matrix

H = findHomography( src2Dfeatures, dst2Dfeatures, outlierMask, RANSAC, 3);

并获得H矩阵,然后将图像与

and getting H matrix, then align image with

warpPerspective(img1,alignedSrcImage,H,img2.size(),INTER_LINEAR,BORDER_CONSTANT);

我需要知道旋转角度,缩放,有没有任何简单的方法来获得这个比一些大的方程?一些计算公式只是为了将数据放入?

I need to know rotation angle, scale, displacement of detected element. Is there any simple way to get this than some big equations? Some evaluated formulas just to put data in?

推荐答案

同位素将匹配您的元素在平面上的投影或躺在任意3D如果相机通过纯旋转或缩放而没有平移。所以这里是我们谈论的情况,指示我们的计算是什么输入:

- 平面目标,纯旋转,帧内单应性

- 平面目标,旋转和翻译,目标到帧单应性

- 3D目标,纯旋转,帧到帧映射(受基本矩阵约束)

Homography would match projections of your elements lying on a plane or lying arbitrary in 3D if the camera goes through a pure rotation or zoom and no translation. So here are the cases we are talking about with indication of what is the input to our calculations:
- planar target, pure rotation, intra-frame homography
- planar target, rotation and translation, target to frame homography
- 3D target, pure rotation, frame to frame mapping (constrained by a fundamental matrix)

平面目标,纯旋转容易通过帧到帧单色像素(H sub 12)来计算:给定内在相机矩阵A的
,对于帧H1的平面到图像单应性, H 2可以表示为H 1 1 = A,H 2 = A * R,H 12 = H 2 * H 1,-1 = A * R * A -1 ,因此R = A -1 H 12 * A

In case of the planar target, a pure rotation is easy to calculate through your frame-to-frame Homography (H12): given intrinsic camera matrix A, plane to image homographies for frame H1, and H2 that can be expressed as H1=A, H2=A*R, H12 = H2*H1-1=A*R*A-1 and thus R=A-1H12*A

如果元素位于平面上,则可以通过目标到帧单应性的分解来计算相机的平移(直到未知尺度)的旋转。注意,目标可以只是其中一个视图。假设你有你的原始平面目标作为一个图像(在一些参考方向拍摄),你的任务是分解图像H 12 之间的单应性,这可以通过SVD完成。 H的前两列表示旋转矩阵的前两列,并且可以通过H = ULV T ,[r1 r2] = UDV T 来恢复,其中D是3x2标识矩阵,最后一行全为0.旋转矩阵的第三列只是前两列的向量积。

In case of elements lying on a plane, rotation with translation of the camera (up to unknown scale) can be calculated through decomposition of target-to-frame homography. Note that the target can be just one of the views. Assuming you have your original planar target as an image (taken at some reference orientation) your task is to decompose the homography between images H12 which can be done through SVD. The first two columns of H represent the first two columns of the rotation martrix and be be recovered through H=ULVT, [r1 r2] = UDVT where D is 3x2 Identity matrix with the last row being all 0. The third column of a rotation matrix is just a vector product of the first two columns. The last column of the Homography is a translation vector times some constant.

最后,对于3D中的点和纯相机旋转的任意配置,旋转是使用必要矩阵计算的分解而不是单应性,请参阅

Finally for arbitrary configuration of points in 3D and pure camera rotation, the rotation is calculated using the essential matrix decomposition rather than homography, see this

这篇关于发现单体和扭曲的观点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆