Projective Geometry Upto28jan
Projective Geometry Upto28jan
Projective Geometry Upto28jan
photodiode
https://micro.magnet.fsu.edu/primer/digitalimaging/cmosimagesensors.html http://www.ysctech.com/digital-microscope-CCD-camera-info.html
CMOS fabrication
CMOS vs. CCD
https://meroli.web.cern.ch/lecture_cmos_vs_ccd_pixel_sensor.html
Rolling shutter artefact (write the difference between
temporal aliasing (waggon wheel effect) and rolling
shutter artefacts )
Vanishing points and lines
Recap : Vanishing point
Vertical vanishing
point
(at infinity)
Vanishing
Vanishing
point
point
v’ ? v ?
. .
Camera Camera
Center
Center
u (0, 0, 0)
u’ (0, 0, 0)
u'
x=
v'
f 2
If X = 2, Y = 3, u' = x * u' = 2 *
z 5
If X = 2, Y = 3, Z = 5, and f = 2 v' y f 2
What are U and V? = v' = y * v' = 3 *
Z = 5, and f = 2 f z z 5
What are U and V?
Projection: world coordinates!image coordinates
Optical
Center
.
. .
(u0, v0)
f Z Y
.u
Camera
Center
(tx, ty, tz)
Invariant to scaling
x kx kx x
k y = ky kw
ky = w
y
kw w
w kw
Homogeneous Cartesian
Coordinates Coordinates
Projection matrix
R,t
jw
X
kw
Ow
x iw
x
u f 0 0 0
y
x=K I 0 X w v = 0 f 0 0
z
1 0 0 1 0
1
Slide Credit: Savarese
Projection Matrix
Remove assumption: known optical center
x
u f 0 u0 0
y
x=K I 0 X w v = 0 f v0 0
z
1 0 0 1 0
1
Projection matrix
Remove assumption: square pixels
x
u 0 u0 0
y
x=K I 0 X w v = 0 v0 0
z
1 0 0 1 0
1
Camera Projection matrix
Remove assumption: non-skewed pixels
x
u s u0 0
y
x=K I 0 X w v = 0 v0 0
z
1 0 0 1 0
1
Camera Projection matrix
Oriented and Translated Camera
R
jw
X
t kw
Ow
x iw
Camera Projection matrix
Allow camera translation
x
u 0 u0 1 0 0 t x
y
x=K I t X w v = 0 v0 0 1 0 t y
z
1 0 0 1 0 0 1 tz
1
Camera Projection matrix
Slide Credit: Saverese
3D Rotation of Points
1 0 0
Rx ( ) = 0 cos sin
p’
0 sin cos
cos 0 sin
Ry ( ) = 0 1 0
p
y
sin 0 cos
cos sin 0
Rz ( ) = sin cos 0
z
0 0 1
Camera Projection matrix
Allow camera rotation
x=K R t X
x
u s u0 r11 r12 r13 t x
y
w v = 0 v0 r21 r22 r23 t y
z
1 0 0 1 r31 r32 r33 t z
1
Camera Projection matrix
Degrees of freedom
x=K R t X
5 6
x
u s u0 r11 r12 r13 t x
y
w v = 0 v0 r21 r22 r23 t y
z
1 0 0 1 r31 r32 r33 t z
1
Field of View (Zoom, focal length)
Lens distortion in camera
Beyond Pinholes: Radial Distortion
• ︎ This unit covers the topics of the Szeliski book, chapter 2.1
(y)
x 2
X= ∈ℝ
x
(1)
X̃ = y ∈ℙ 2
x̃ x
(1)
= ( ) = X̄
y X
X̃ = ỹ =
1
w̃
with augmented vector X̄.To convert in the opposite direction we divide by w̃:
x̃
x x̃ w̃
(1)
1 1
= ( ) = X̃ =
y X ỹ =
X̄ = x̃
1 w̃ w̃ w̃
w̃
1
Homogeneous points whose last element is w̃ = 0 are called ideal points or points at infinity. These
points can’t be represented with inhomogeneous coordinates!
�D Points
Homogeneous Vector
2D-
points
Augmented Vector
Homogeneous Inhomogeneous
Coordinates Coordinates
2D-Line
˜
2D lines can also be expressed using homogeneous coordinates l = [a, b, c] T
˜T
{X̄ | l X̄ = 0} ⇔ {x, y | ax + by + c = 0}
˜ ˜ T
We can normalize l so that l = (nx, ny, d) = (n, d) with | | n | | = 1. In this case, n is the normal
vector perpendicular to the line and d is its distance to the origin.
An exception is the line at infinity l∞ = (0,0,1) which passes through all ideal points.
Cross Product
Cross product expressed as the product of a skew-symmetric matrix and a vector:
˜ ˜
X̃ = l1 × l2
Similarly, the line joining two points can be compactly written as:
˜l = X̃1 × X̃2
2 30 1 0 1 0 1
0 1 1 1 2 2
6 7B C B C B C
l̃1 ⇥ l̃2 = [l̃1 ]⇥ l̃2 = 4 1 0 05 @ 0 A = @ 1A = @1A
1 0 0 2 1 1
�D Line Arithmetic
2 30 1 0 1 0 1
0 1 0 1 0 ⇣ ⌘> 0
6 7B C B C B C
l̃1 ⇥ l̃2 = [l̃1 ]⇥ l̃2 = 4 1 0 15 @ 0 A = @1A 0 0 1 @1A = 0
0 1 0 2 0 | {z } 0
l̃1
��
2.2 The 2D projective plane 29
x2
ideal
point
O x3
x
x1
Fig. 2.1. A model of the projective plane. Points and lines of IP2 are represented by rays and planes,
respectively, through the origin in IR3 . Lines lying in the x1 x2 -plane represent ideal points, and the
x1 x2 -plane represents l∞ .
2
points lie on a single line. This is not true in the standard Euclidean geometry of IR ,
Vanishing point
Vanishing points
image plane
vanishing point v
COP
Vanishing point
• projection of a point at infinity
Vanishing points
image plane
vanishing point v
COP
Properties
• Any two parallel lines have the same vanishing point v
• The ray from COP through v is parallel to the lines
From: http://www.atpm.com/9.09/design.shtml
2
Conics in P
Conics in P2
or in homogeneous coordinates as
x̃
ỹ 3
X̃ = ∈ℙ
z̃
w̃
3 4
with projective space ℙ = ℝ excluding{(0,0,0,0)}
�D Planes
3D-Planes
�D planes can also be represented as homogeneous coordinates m̃ = (a, b, c, d) :
>
>
{x̄ | m̃ x̄ = 0} , {x, y, z | ax + by + cz + d = 0}
this case, n is the normal perpendicular to the plane and d is its distance to the origin.
An exception is the plane at in�nity m̃ = (0, 0, 0, 1) > which passes through all ideal
points (= points at in�nity) for which w̃ = 0.
�D Planes
3D
Planes
�D Lines
3D lines
�D lines are less elegant than either �D lines or �D planes. One possible representation
is to express points on a line as a linear combination of two points p and q on the line:
{x | x = (1 )p + q ^ 2 R}
��
�D Quadrics 3D quadrics
The �D analog of �D conics is a quadric surface:
>
{x̄ | x̄ Q x̄ = 0}
Useful in the study of multi-view geometry. Also serves as useful modeling primitives
(spheres, ellipsoids, cylinders), see Hartley and Zisserman, Chapter � for details.
�8
Projective transformation
tions. From
possible, basedthis
on point of view, result.
the following 2D projective geometry is the study of properties of
2
the projective plane IP that are invariant transformations
2.3 Projective under a group of transformations known 33 as
projectivities. 2 2
Theorem 2.10. A mapping h : IP → IP is a projectivity if and only if there exists a
A projectivity
non-singular
mous.
isvectors)
true
3
toh(x)
that
×Projective transformation
(a helpful name), a projective transformation or a homography:
points
=
is matrix
3 an invertible
inHx. 2
H such mapping
that for from
any points
point in IP 2
in IP
IP that maps lines to lines. More precisely,
2
the
represented
terms
by
are
a
synony-
(that is homogeneous
vector x 3-it
In definition 2.9, a projectivity is defined in terms of a coordinate-free geometric
2
concept
Definition of 2.9.
pointAline incidence.is An
projectivity an equivalent
invertible2
algebraic
mapping hdefinition
from IP of
to a projectivity
itself such is
that
To interpret
possible, based
this theorem, any point in IP is represented as a homogeneous 3-vector,
three points x1 ,onx2the
andfollowing
x3 lie on result.
the same line if and only if h(x1 ), h(x2 ) and h(x3 ) do.
x, and Hx is a linear mapping of homogeneous coordinates. The theorem asserts that
any Projectivities
projectivity form aasgroup
arises such since
a 2 thetransformation
linear inverse
2 of a projectivity
in is also a coordinates,
homogeneous projectivity, and
Theorem 2.10. A mapping h : IP → IP is a projectivity if and only if there exists a
so is
that the composition
conversely any suchof mapping
two projectivities.
is a A projectivity
projectivity. The 2 is alsowill
theorem called
not a be
collineation
proved in
non-singular 3 × 3 matrix H such that for any point in IP represented by a vector x it
full here. It will
is true that h(x) = Hx. only be shown that any invertible linear transformation of homoge-
neous coordinates is a projectivity.
2
To interpret this theorem, any point in IP is represented as a homogeneous 3-vector,
T
Proof.
x, and Hx Letisxa1 ,linear
x2 and x3 lie on
mapping of ahomogeneous
line l. Thus coordinates.
l xi = 0 for The i = theorem
1, . . . , 3.asserts
Let H that
be a
T −1
non-singular
any projectivity 3 ×arises
3 matrix. One
as such verifies
a linear that l H Hxin
transformation i = 0. Thus, the coordinates,
homogeneous points Hxi alland lie
−T
on
thatthe line H l,any
conversely andsuch
collinearity
mappingisispreserved
a projectivity.by theThetransformation.
theorem will not be proved in
full here.
The It will
converse only be shown
is considerably that to
harder anyprove,
invertible
namelylinear
thattransformation
each projectivity of homoge-
arises in
neous
this way.coordinates is a projectivity.
The converse is considerably harder to prove, namely that each projectivity arises in
this way. Definition of projective
transformation
As a result of this theorem, one may give an alternative definition of a projective
transformation (or collineation) as follows.
Note that the matrix H occurring in this equation may be changed by multiplication
by an arbitrary non-zero scale factor without altering the projective transformation.
Consequently we say that H is a homogeneous matrix, since as in the homogeneous
34 2 Projective Geometry and Transformations of 2D
/
x
O
/
y/
x/ y
x
Fig. 2.3. Central projection maps points on one plane to points on another plane. The projection
also maps lines to lines as may be seen by considering a plane through the projection centre which inter-
sects with the two planes π and π! . Since lines are mapped to lines, central projection is a projectivity
and may be represented by a linear mapping of homogeneous coordinates x = Hx.!
R,t x
x image 1 x x
x
x/
image 2
X
planar surface
a b c
Fig. 2.5. Examples of a projective transformation, x! = Hx, arising in perspective images. (a)
The projective transformation between two images induced by a world plane (the concatenation of two
projective transformations is a projective transformation); (b) The projective transformation between
two images with the same camera centre (e.g. a camera rotating about its centre or a camera varying its
focal length); (c) The projective transformation between the image of a plane (the end of the building)
and the image of its shadow onto another plane (the ground plane). Figure (c) courtesy of Luc Van Gool.
CS 4495 Computer Vision – A. Bobick
Isometrics
Two Views Part 1: 2D transforms and
Projective Geometry
• Preserves:
• Lengths/Areas R
• Angles
R
• Orientation
• Lines
the matrix diag(−1, 1, 1),
2.4.1 Class with a Euclidean transformation.
I: Isometries Two Views Part 1: 2D transforms and
Isometrics
CS 4495 Computer Vision – A. Bobick Projective Geometry
2
Isometries are transformations of the plane IR that preserve Euclidean
Euclidean transformations modelAnthe motion of aasrigid o
Special Projective Transformations
iso = same, metric = measure). isometry is represented
most important isometries in practice, !
x
and
! cos θ − wesin θwill
tx concentr
x
!
• Euclidean (Rigid body) y = ! sin θ
orientation reversing isometries1 often arise cos θ ty y
as ambiguities in
0 0 1 1
x' A planar
cos( ) Euclidean ) !t x= transformation
sin(where x can be written more c
±1. If ! = 1 then the isometry is orientation-preserving and
transformation (a composition of a translation-and rotation)..If ! = −1
y' sin( ) cos( ) t y y R t
try reverses orientation. An! example is the composition of a reflection
x =H x=
the matrix diag(−1, 1, 1), with a Euclidean transformation. x
1 0 0 1 1 E T
0 1
Euclidean transformations model the motion of a rigid object. The
most important isometries in practice, and we will concentrate on thes
where R is a 2 × 2 rotation matrix (an orthogonal matrix s
orientation reversing isometries often arise as ambiguities in structure r
A planar Euclidean transformation can be written more concisely in
t a translation 2-vector, and 0 a null 2-vector.
• Preserves: - Special
. case
! R t
• Lengths/Areas
t = 0) and a pure x = x =
R translation (when R = I). 0A 1Euclidean tra
H T x E
• Angles
• Lines
as a displacement.
where R is a 2 × 2 rotation matrix (an orthogonal matrix such that R T
Affine Transform
CS 4495 Computer Vision – A. Bobick Projective Geometry
where R(θ) and R(φ) are rotations by θ and φ respectively, and D is a diagonal matrix:
! "
λ1 0
D= .
0 λ2
40 2 Projective Geometry and Transformations of 2D
This decomposition follows directly from the SVD (section A4.4(p585)): writing A =
UDVT = (UVT )(VDVT ) = R(θ) (R(−φ) D R(φ)), since U and V are orthogonal matrices.
The affine matrix A is hence seen to be the concatenation of a rotation (by φ); a
scaling by λ1 and λ2 respectively in the (rotated) x and y directions; a rotation back
(by −φ); and finally another rotation (by θ). The only “new” geometry, compared to
a similarity, is the non-isotropic scaling. This accounts for the two extra degrees of
freedom possessed by an affinity over a similarity. They are the angle φ specifying the
scaling direction, and the ratio of the scaling parameters λ1 : λ2 . The essence of an
affinity is this scaling in orthogonal directions, oriented at a particular angle. Schematic
examples are given in figure 2.7.
rotation deformation
a b
Two Views Part 1: 2D tran
CS 4495 Computer Vision – A. Bobick Projectiv
Projective Transformations
• Remember, these are homogeneous coordinates
x' sx ' a b c x
y' sy ' d e f y
1 s 0 0 s 1
A projective transformation was defined in (2.5). It is a ge
! "
sr11 sr12 tx
Similarity Ratio of lengths, angle. The circular points, I, J
sr21 sr22 ty
4 dof (see section 2.7.3).
0 0 1
! "
r11 r12 tx
Euclidean r21 r22 ty Length, area
3 dof 0 0 1
2D Transformation
�D Transformations
2D
�D Transformations Transformation
Transformation hierarchy: isometries
(iso=same, metric=measure)
& x' # ,ε cosθ − sin θ t x )& x #
$ ! * ' $ !
$ y ' ! = * ε sin θ cosθ t y '$ y ! ε = ±1
$1! * 0 0 1 '($% 1 !"
% " +
orientation preserving: ε =1
orientation reversing: ε = −1
& R t#
x' = H E x = $ T ! x T
R R=I
%0 1"
3DOF (1 rotation, 2 translation)
special cases: pure rotation, pure translation
Euclidean: (�D Translation + �D Rotation, � DoF)
" area
Invariants: length, angle, #
0 0R t
x = Rx + t , x̄ = > x̄ 15
0 1
I R 2 SO(2) is an orthonormal rotation matrix with RR> = I and det(R) = 1
I Euclidean transformations preserve Euclidean distances
��
�D Transformations
INFORMATIK2D transformation
Transformation hierarchy: similarities
& x' # , s cosθ − s sin θ t x )& x # (isometry + scale)
$ ! * ' $ !
$ y ' ! = * s sin θ s cosθ t y '$ y !
$1! * 0 0 $
1 (% 1 "
' !
% " +
& sR t #
x' = H S x = $ T ! x R T
R I
Similarity: (�D Translation + Scaled �D
% 0 1" Rotation, � DoF) =
" #
0 0 sR t
4DOF (1x scale,
= sRx +t ,
1 rotation, x̄ = >
2 translation) x̄
0 1
also know as equi-form (shape preserving)
I R2 SO(2) is metric
a rotation matrix
structure and s up
= structure is an arbitrary(inscale
to similarity factor
literature)
I The similarity transform preserves
Invariants: ratios angles
of length, angle,between lines
ratios of areas,
�D Transformations 2D Transformation
INFORMATIK
2D transformation
�D Transformations Transformation hierarchy: homographies
& h11 h12 h13 # !
$ ! &A t#
H P = $ h21 h22 h23 ! = $$ ! T !!
$h ! % v v"
h
% 31 32 h33 "
Changes
homogeneous
coordinate!
&A t# T
x' = H
Perspective: (Homography, 8 DoF) P x = $vT ! x v = (v1 , v2 )
% v"
✓ ◆
0 1
x̃ = H̃ x̃ x̄ = x̃
8DOF (2 scale, 2 rotation, w̃
2 translation, 2 line at infinity)
$% 0 0 1 !"
& r11 r12 t x #
Euclidean $r !
3dof $ 21 r22 t y!
$% 0 0 1 !"
19
2D transformation
�D Transformations on Co-Vectors of co-vectors
Considering any perspective �D transformation
0
x̃ = H̃x̃
Therefore, we have:
0 >
l̃ = H̃ l̃
–Johnny Appleseed
Next class homography estimation
Direct Linear Transform for Homography Estimation
Direct linear transformation
How can we estimate a homography from a set of �D correspondences?
Let X = {x̃i , x̃i }i=1 denote a set of N �D-to-�D correspondences related by x̃i = H̃x̃i .
0 N 0
As the correspondence vectors are homogeneous, they have the same direction but
differ in magnitude. Thus, the equation above can be expressed as x̃i ⇥ H̃x̃i = 0.
0
Using h̃k to denote the k’th row of H̃, this can be rewritten as a linear equation in h̃:
>
2 32 3
0 > 0 >
w̃i x̃i 0 >
ỹi x̃i h̃1
6 0 > > 0 > 76 7
4 w̃i x̃i 0 x̃i x̃i 5 4h̃2 5 =0
0
ỹi x̃i> 0 >
x̃i x̃i 0 > h̃3
| {z } | {z }
Ai h̃
The last row is linearly dependent (up to scale) on the �rst two and can be dropped.
Direct Linear Transformation
Direct Linear Transform for Homography Estimation
Each point correspondence yields two equations. Stacking all equations into a 2N ⇥ 9
dimensional matrix A leads to the following constrained least squares problem
⇤ 2 2
h̃ = argmin kAh̃k2 + (kh̃k2 1)
h̃
> > >
= argmin h̃ A Ah̃ + (h̃ h̃ 1)
h̃
2
where we have �xed = 1 as H̃ is homogeneous (i.e., de�ned only up to scale)
kh̃k2
and the trivial solution to h̃ = 0 is not of interest. The solution to the above
optimization problem is the singular vector corresponding to the smallest singular
value of A (i.e., the last column of V when decomposing A = UDV , see > also Deep
http://citeseerx.ist.psu.edu/viewdoc/
summary?doi=10.1.1.186.4411
Learning lecture ��.�). The resulting algorithm is called Direct Linear Transformation.
��
Panorama stitching
Application: Panorama Stitching
What is an image?