Projective transformations
Projective transformations)
一个读者的感悟。
所有的知识点都是来源于书Multiple View of Geometry in Computer Vision 。
这一篇中很多概念都在上一篇2D投影平面中介绍。注:在没有上一篇基础的前提下这一篇难以理解。
这一篇涉及到投影变换的基本概念。
依然,数学真是很奇妙的东西。
Basic definitions
Definition 2.9. A projectivity (also called a collineation) is an invertible mapping h h h from P 2 \mathbb{P}^2 P2 (projective plane) to itself such that three points x 1 x_1 x1, x 2 x_2 x2, x 3 x_3 x3 lines on the same line if and only if h ( x 1 ) h(x_1) h(x1), h ( x 2 ) h(x_2) h(x2), h ( x 3 ) h(x_3) h(x3) do.
Theorem 2.10. A mapping h h h: P 2 → P 2 \mathbb{P}^2 \to \mathbb{P}^2 P2→P2 is a projecticity if and only if there exists a non-singular 3 × \times × 3 matrix H H H such that for any point in P 2 \mathbb{P}^2 P2 relrese ted h a vector x x x it is true that h ( x ) = H x h(x) = Hx h(x)=Hx
Note that the points mentioned above is homogeous coordinates. The theorem indicates that the projectivity is a linear transformation and the linear mapping is projectivity
Proof:
x
1
x_1
x1,
x
2
x_2
x2,
x
3
x_3
x3 lie on the line
l
l
l. Thus
l
T
x
i
=
0
l^Tx_i =0
lTxi=0 for
i
=
1
,
2
,
3
i = 1,2,3
i=1,2,3. Given
H
H
H is a non-singular 3
×
\times
× 3 matrix. We can get
l
T
H
−
1
H
x
i
=
0
l^TH^{-1}Hx_i =0
lTH−1Hxi=0. Thus
H
x
i
Hx_i
Hxi all lie on the line
l
′
=
H
−
T
l
l{'} = H^{-T}l
l′=H−Tl.
Definition 2.11. Projective transformation A planar projective transformation is a linear transformation on homogeneous 3-vectors represented by a non-sigular 3 × \times × 3 matrix:
( x 1 ′ x 2 ′ x 3 ′ ) = ( h 11 h 12 h 13 h 21 h 22 h 23 h 31 h 32 h 33 ) = ( x 1 x 2 x 3 ) \begin{pmatrix} x_1{'} \\ x_2{'} \\x_3{'} \end{pmatrix} = \begin{pmatrix} h_{11} &h_{12} &h_{13} \\h_{21} &h_{22} &h_{23} \\ h_{31} &h_{32} &h_{33} \end{pmatrix} = \begin{pmatrix} x_1 \\ x_2 \\x_3 \end{pmatrix} ⎝⎛x1′x2′x3′⎠⎞=⎝⎛h11h21h31h12h22h32h13h23h33⎠⎞=⎝⎛x1x2x3⎠⎞, more briefly, x ′ = H x x^{'} = Hx x′=Hx.
Note that the equation won’t change when multiply any non-zero scala (非零常数) to
H
H
H.
The
H
H
H has 8 ratios so has 8 degrees of freedom.
In the ray model in Figure 2.1 (2D投影平面), any projective transformation is linear transformation of
R
3
\mathbb{R^3}
R3
Example 2.12. Removing the projective distortion from a perspective image of a plane.
(需补充图片2.4)
Let original image point be
(
x
,
y
)
(x, y)
(x,y) and the point at image plane is
(
x
′
,
y
′
)
(x{'}, y{'})
(x′,y′) in inhomogeous system. Thus we can get:
x
′
=
x
1
′
x
3
′
=
h
11
x
+
h
12
y
+
h
13
h
31
x
+
h
32
y
+
h
33
x{'} = \frac{x_1{'}}{x_3{'}} = \frac{h_{11}x + h_{12}y + h_{13}}{h_{31}x + h_{32}y + h_{33}}
x′=x3′x1′=h31x+h32y+h33h11x+h12y+h13,
y
′
=
x
2
′
x
3
′
=
h
21
x
+
h
22
y
+
h
23
h
31
x
+
h
32
y
+
h
33
y{'} = \frac{x_2{'}}{x_3{'}} = \frac{h_{21}x + h_{22}y + h_{23}}{h_{31}x + h_{32}y + h_{33}}
y′=x3′x2′=h31x+h32y+h33h21x+h22y+h23.
Thus we can get two equations at each point for the elements of H H H, which can be written as:
x
′
(
h
31
x
+
h
32
y
+
h
33
)
=
h
11
x
+
h
12
y
+
h
13
x{'}(h_{31}x + h_{32}y + h_{33}) = h_{11}x + h_{12}y + h_{13}
x′(h31x+h32y+h33)=h11x+h12y+h13,
y
′
(
h
31
x
+
h
32
y
+
h
33
)
=
h
21
x
+
h
22
y
+
h
23
y{'}(h_{31}x + h_{32}y + h_{33} )=h_{21}x + h_{22}y + h_{23}
y′(h31x+h32y+h33)=h21x+h22y+h23,
where the equations are linear for the element of H. For 4 points of image, we can get 8 equations, which sufficient to solve H H H. Note that the 4 points can not be collinear. The example is shown as Figure 2.4.
Properties:
- It doesn’t need knowledge of camera (parameters or position).
- 4 points are not necessary (describedin section 2.7(之后的博客中会提及到)).
(需要补充图片2.5)
A variety of projective transformations are shown in the Figure 2.5.
Transformations of lines and conics
Transformations of lines
From the Theorem 2.10 and 2.11, after projective transformation, the points
x
i
x_i
xi belongs to line
l
l
l can be written as
x
i
′
=
H
x
i
x_i{'} = Hx_i
xi′=Hxi line on the line:
l
′
=
H
−
T
l
l{'} = H^{-T}l
l′=H−Tl. Or
l
′
T
=
l
T
H
−
1
l'^{T} = l^{T}H^{-1}
l′T=lTH−1. Thus we can say that points transformation according to
H
H
H while lines transformation according to
H
−
1
H^{-1}
H−1.
We can say points transform contravariantly and lines transform covariantly.
Transformations of conics
Given x ′ = H x x{'} = Hx x′=Hx, x T C x = x ′ T [ H − 1 ] T C H − 1 x ′ = x ′ T H − T C H − 1 x ′ x^TCx = x'^{T}[H^{-1}]^TCH^{-1}x{'} = x^{'T}H^{-T}CH^{-1}x^{'} xTCx=x′T[H−1]TCH−1x′=x′TH−TCH−1x′, which is quadratic form x ′ T C ′ x ′ x'^{T}C'x{'} x′TC′x′, where C ′ = H − T C H − 1 C' = H^{-T}CH^{-1} C′=H−TCH−1.
Result 2.13. Under a point transformation x ′ = H x x{'} = Hx x′=Hx, a conic C C C transforms to C ′ = H − T C H − 1 C' = H^{-T}CH^{-1} C′=H−TCH−1.