问题描述
我有两个图像,并使用筛选找到三个类似的2D点。我需要计算图像之间的仿射变换。不幸的是,我错过了讲座,那里的信息对我来说有点密集。计算这个2×3矩阵的一般方法是什么?
I have two images and found three similar 2D points using a sift. I need to compute the affine transformation between the images. Unfortunately, I missed lecture and the information out there is a little dense for me. What would the general method be for computing this 2x3 matrix?
我有一个2×3矩阵[x1 y1; x2 y2; x3 y3]的点矩阵,失去了。
感谢任何帮助。
I have the matrix of points in a 2x3 matrix [x1 y1;x2 y2;x3 y3] but I am lost from there.Thanks for any help.
推荐答案
通常,2D点的仿射变换表示为
Usually, an affine transormation of 2D points is experssed as
x' = A*x
$ b b
其中 x
是三向量 [x; y; 1]
的原始2D位置, x'
是转换的点。仿射矩阵 A
是
Where x
is a three-vector [x; y; 1]
of original 2D location and x'
is the transformed point. The affine matrix A
is
A = [a11 a12 a13;
a21 a22 a23;
0 0 1]
此表格在 x
和 A
都是已知,并且您希望恢复 x'
。
但是,您可以以不同的方式表达此关系。
让
However, you can express this relation in a different way.Let
X = [xi yi 1 0 0 0;
0 0 0 xi yi 1 ]
和 code>是一个列向量
and
a
is a column vector
a = [a11; a12; a13; a21; a22; a23]
然后
X*a = [xi'; yi']
保存所有对对应点
x_i,x_i' / code>。
Holds for all pairs of corresponding points
x_i, x_i'
.
当您知道点对之间的对应关系并且您希望恢复
A 。
将所有点放在一个大矩阵中 X
(每个点两行),你将有2 * n-by矩阵 X
乘以未知数的向量 a
等于堆叠的2×n乘1列向量对应点(由 x_prime
表示):
This alternative form is very useful when you know the correspondence between pairs of points and you wish to recover the paramters of
A
.
Stacking all your points in a large matrix X
(two rows for each point) you'll have 2*n-by-6 matrix X
multiplyied by 6-vector of unknowns a
equals a 2*n-by-1 column vector of the stacked corresponding points (denoted by x_prime
):
X*a = x_prime
解决
a
:
a = x_prime \ X
以最小二乘意义恢复
a
Recovers the parameters of
a
in a least-squares sense.
祝你好运, class!
Good luck and stop skipping class!
这篇关于给定三点计算仿射变换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!