giacomo boracchi - cvpr usi 2020
TRANSCRIPT
Giacomo Boracchi
Single-View GeometryGiacomo Boracchi
February 25th, 2020
USI, Lugano
Book: HZ, chapter 2
Giacomo Boracchi
Planar Geometry
Today we will study the geometry on the image plane Ξ , and in particular
the properties of points and lines and their relationships
XY
ππΆ π
π
π₯
y
π
π
Ξ
Giacomo Boracchi
Points in β2
In homogeneous coordinates a point on Ξ corresponds to a triplet
π = π₯, π¦, π€ βΊ
We will always consider column vectors as these are more convenient in
linear algebra operations
In homogeneous coordinates a point corresponds to a class of equivalence that includes all the scaled versions of π
π = π₯, π¦, π€ βΊ =π₯
π€,π¦
π€, 1
βΊ
The latter representation is mapped in β2 by removing the last coordinate
π₯
π€,π¦
π€, 1
βΊ
βπ₯
π€,π¦
π€
βΊ
β β2
Giacomo Boracchi
Lines in β2
In β2 the equation of a line π is
ππ₯ + ππ¦ + π = 0
being βπ/π the angular coefficient and βπ/π the intercept
π
βπ/πβπ/π
Giacomo Boracchi
Lines in β2
Thus we can associate a point to each line
π β π, π, π βΊ
This association is not one-to-one since πππ₯ + πππ¦ + ππ = 0, π β 0identifies the same line but with different parameters
π β ππ, ππ, ππ βΊ
Thus, representations ππ, ππ, ππ βΊ and π, π, π βΊ do coincide
Rmk: lines are naturally represented in β2
Rmk: this is the reason why a line has 3 coefficients but indeed only two
degrees of freedom (gradient and intercept)
Rmk: the vector 0,0,0 βΊ does not correspond to any line
π
βπ/πβπ/π
Giacomo Boracchi
Incidence relation
A point π β β2, π = (π₯, π¦) belongs to a line π = π, π, π βΊ if and only if
ππ₯ + ππ¦ + π = 0
The above relation can be written as
π, π, π β π₯π¦1
= 0
Where β denotes the scalar product. Then
Property (incidence):
A point π β β2 lies on the line π if and only if
πβΊπ = πβΊπ = 0
Giacomo Boracchi
Incidence relation
A point π β β2, π = (π₯, π¦) belongs to a line π = π, π, π βΊ if and only if
ππ₯ + ππ¦ + π = 0
The above relation can be written as
π, π, π β π₯π¦1
= 0
Where β denotes the scalar product. Then
Property (incidence):
A point π β β2 lies on the line π if and only if
πβΊπ = πβΊπ = 0
This is the reason why this
number i set to 1 when
moving from Euclidean to
homogeneous coordinates
Giacomo Boracchi
Intersection of lines
Property (intersection of lines):
The intersection of two lines π, π, their intersection π β β2 is
π = π Γ π
where Γ denote the cross product of two 3-dimensional vectors.
Giacomo Boracchi
Cross Product
Let π, π β β3 be two vectors, their cross product is a vector π Γ π β β3
β’ That is perpendicular to the plane < π, π >
β’ Has orientation of the right-hand rule
β’ Has lenght proportional to the area of the parallelogram spanned by
the vectors, π Γ π = π π sinπ½
By Acdx - Self-made
Giacomo Boracchi
Cross Product
Rmk: the cross product can be also computed as
π Γ π =ππ1π1
ππ2π2
ππ3π3
being π, π, π the versors of β3 and β the determinant
Rmk: the cross product is anti-commutative
π Γ π = βπ Γ π
But this is not an issue when we want to intersect two lines, since the
result in the same point of β2 (equivalence up to a multiplication by β1)
Giacomo Boracchi
Cross Product
Rmk: the cross product is distributive over addition
π Γ π + π = π Γ π + π Γ π
Rmk: the cross product is compatible with scalar product
π π Γ π = ππ Γ π = π Γ ππ
Giacomo Boracchi
Cross Product
Rmk: the cross product is not associative
π Γ π Γ π β π Γ π Γ π
Rmk: the triple scalar product identity follows by definition of cross
product (which is orthogonal to both terms)
π β π Γ π = π β π Γ π = 0
This also proves the fact the intersection of two lines π β© π is π = π Γ π
In fact π belongs to both π and π since the incidence equation is satisfied
π β π Γ π = π β π Γ π = 0
Giacomo Boracchi
Line joining two points
Property: given π, π β β2, the line π joining π and π is
π = π Γ π
Rmk this can be verified by checking that both π and π belong to π Γ πthrough the incidence equation
Rmk: we have seen that the cross product is anti-commutative
π Γ π = βπ Γ π
This is not an issue for the resulting lines, since these are intrinsecally
equivalent up to a multiplication by a scalar
Giacomo Boracchi
An interesting property
An interesting property, given two points in homogeneous coordinates
π = π1; π2; π3 and π = π1; π2; π3 any linear combination ππ + ππ,π, π β β belongs to the line joining π, π
Proof
Let π = π Γ π, for which holds πβΊπ = πβΊπ = 0 (incidence equation)
Then, ππ + ππ πβΊ = πππβΊ + πππβΊ = 0 + 0
Giacomo Boracchi
Angles in the Euclidean Plane
In Euclidean geometry the angle between two lines is computed from the
dot product of their normals. For the lines π = (π1; π2; π3), and π =(π1;π2;π3), the angle π is such that
cos π =π1π1 + π2π2
π12 + π2
2 (π12 +π2
2)
We will see later interesting properties on projective plane
Giacomo Boracchi
Intersection of parallel Lines
Consider two parallel lines π = π, π, π and π = (π, π, π), then their intersection is:
π Γ π =πππ
πππ
πππ
= π ππ β ππ β π ππ β ππ + π ππ β ππ
π Γ π =ππ β ππππ β ππ
0= (π β π)
πβπ0
That corresponds to the homogeneous point π = π,βπ, 0 βΊ
Rmk if we try to move to Euclidean coordinates we get π
0,π
0which goes
to infinity.
These are the ideal points or points at the infinity
Giacomo Boracchi
Point at the Infinity
Definition: a point of β2 with the third coordinate equal zero is a point at
the infinity (or ideal point)
Rmk: π = π, π, π βΊ passes through the ideal point πβ = π,βπ, 0 βΊ
Rmk: ideal points can be seen as sort of directions
Rmk: β2 augments β2 by including directions
Rmk: finite points in β2 are those having the third coordinate β 0 and
these corresponds to β2 up to a normalization factor
Giacomo Boracchi
Line at the infinity ββ
Property: all the ideal points lie in the line at the infinity ββ having
coordinates
ββ = 0; 0; 1
Rmk: Thanks to ideal points
β’ any pair of lines in β2 intersect in a single (homogeneous) point.
β’ any pair of points of β2 lie a single line
This does not hold in β2 where parallel lines do not meet.
ββπ1 π2
πβπ1π2
πβ
Giacomo Boracchi
Example
Isometric cube, draw missing points as the intersection of lines parallel to
this and passing through another point
Giacomo Boracchi
A model for β2
Points of β2 are represented by all the rays of
β3 through the origin, since all
π = π π; π; 1 , βπ
corresponds to the same point
Lines of β2 are represented as planes passing
through the origin
The Euclidean plane is the plane ππ = 1 and
projection to Euclidean coordinates is
computing the intersection between the ray and
the plane Ξ , i. e. , ππ = 1.
Lines lying in the plane ππ = 0 represent ideal
points (directions) as these do not instersect Ξ .Hartley Zisserman Fig.2.1
Giacomo Boracchi
Point Line Duality in β2
Duality principle. To any theorem of 2-dimensional projective geometry (β2)there corresponds a dual theorem, which may be derived by interchanging the roles of points and lines in the original theorem.
Theorem Dual Theorem
- Point β - Line
- Line β - Point
- Belongs to β - Go through
- Go through β - Belongs to
E.g. The incidence equation, the line passing through two points which has the same formulation of the intersection between lines
Rmk: Note that is it not necessary to prove the dual of a given theorem once the original theorem has been proved
Giacomo Boracchi
Linear Combinations in β2
An interesting property, given two points in homogeneous coordinates
π = π1; π2; π3 and π = π1; π2; π3 any linear combination ππ + ππ,π, π β β belongs to the line joining π, π
Proof
Let π = π Γ π, for which holds πβ²π = πβ²π = 0 (incidence equation)
Then, ππ + ππ πβ² = πππβ² + πππβ² = 0 + 0
Giacomo Boracchi
Single-View GeometryGiacomo Boracchi
February 28th, 2020
USI, Lugano
Book: HZ, chapter 4
Giacomo Boracchi
Outline
β’ Trasformations in β2
β’ The Projective Space β3
β’ Vanishing Points
β’ Affine Rectification
Giacomo Boracchi
Homographies
The most general transformation we consider in β2
Definition A projectivity is an invertible mapping β from β2 to itself such
that three points ππ, ππ and π3 lie on the same line if and only if β(π1), β(π2) and β(π3) do.
Rmk this property is called collinearity
Alternative names
β’ Collineation
β’ Projective transformation
β’ Homography
ππΈπ
ππ
Giacomo Boracchi
Homographies
Theorem 2.10. A mapping β:β2 β β2 is a projectivity if and only if there
exists a non-singular 3 Γ 3 matrix π» such that for any point in β2
represented by a vector π it is true that β(π) = π»π
π» =
β1,1β2,1β3,1
β1,2β2,2β3,2
β1,3β2,3β3,3
Each and every linear mapping in β2 is an homography, and only linear
mapping are homographies
Giacomo Boracchi
Homographies and Points in β2
From theorem follows
πβ² = π»π
Rmk: if we scale both πβ² and π by arbitrary factors the relation holds
since we are in β2
πβ² = ππ»π, βπ β β\{0}
Thus, π» has 9 entries but only 8 degrees of freedom, since only the ratio
between the elements counts. π» is said to be an homogeneous matrix.
Giacomo Boracchi
Homographies and Lines in β2
An homography transform each line π in a line π such that:
π = π»β1 βΊ π
We say that points transform contravariantly and lines and conics
transform covariantly.
Giacomo Boracchi
Mapping between planes: homography
Mapping between planes induced by a central projection is an
homography, as this preserves collinearity
If a coordinate system is defined in each plane and points are represented
in homogeneous coordinates, then the central projection mapping may be
expressed by
πβ² = π»π
where π» is a non-singular
3 Γ 3 matrix
Hartley Zisserman Fig.2.3
Giacomo Boracchi
Linear Transformation
We consider linear transformations of β2,
β’ these can be expressed as a 3 Γ 3 matrix π»,
β’ the homogeneous constraint applies
Depending on the structure of π» there are different class of
transformations with a different number of degrees of freedom
Giacomo Boracchi
Isometries
Isometries can be written as
πβ² = π»πΌπ
where
π₯β²π¦β²1
=π cos ππ sin π0
βsinπcos π0
π‘π₯π‘π¦1
π₯π¦1
and π = Β±1.
Giacomo Boracchi
Isometries
Isometries can be written as
πβ² = π»πΌπ
A more compact representation is
π₯β²π¦β²1
=π cos ππ sin π0
β sin πcos π0
π‘π₯
1
π₯π¦1
where R β π(2) is a rotation matrix, i.e. an orthogonal matrix
RβΊR = RRβΊ = πΌ2
And π β βπ is a translation vector .
Pure rotation π = [0; 0], pure translation R = πΌ2
R ππβΊ
Giacomo Boracchi
Isometries: Invariants
Isometries describe a 2D motion of a rigid object
Isometries preserves the angles, the distances, the areas.
Giacomo Boracchi
Isometries: Remarks
Isometries have three degrees of freedom: the rotation angle π and the
translation vector [π‘π₯ , π‘π¦]
π₯β²π¦β²1
=π cos ππ sin π0
β sinπcos π0
π‘π₯π‘π¦1
π₯π¦1
Rmk Isometries can be estimated from two point correspondences
Rmk When π = 1 the isometry preserves the orientation, when π = β1the isometry reverses the orientation.
For instance diag(β1,1,1) is a reflection
Giacomo Boracchi
Isometries: Remarks
Isometries have three degrees of freedom: the rotation angle π and the
translation vector [π‘π₯ , π‘π¦]
π₯β²π¦β²1
=π cos ππ sin π0
β sinπcos π0
π‘π₯π‘π¦1
π₯π¦1
Rmk Isometries do not modify ideal points:
β’ Ideal points in β2 remain ideal points (they might change but always
remain ideal points in ββ)
β’ Finite points in β2 remain finite points
β’ ββ = π»πΌββΊββ
Giacomo Boracchi
Similarities
Similarities can be written as
πβ² = π»ππ
where
π₯β²π¦β²1
=π cos ππ sin π0
βπ sin ππ cos π0
π‘π₯π‘π¦1
π₯π¦1
and π β β
Rmk Similarities can be seen as an isometry composed with an isotropic
scaling of the axis
Giacomo Boracchi
Similarities
Similarities can be written as
πβ² = π»ππ
A more compact representation is
π₯β²π¦β²1
=π cos ππ sin π0
β sin πcos π0
π‘π₯
1
π₯π¦1
where
β’ π β β is the scaling factor
β’ R β π(2) is a rotation matrix,
β’ π β βπ is a translation vector.
π R ππβΊ
Giacomo Boracchi
Similarities: Invariants
Similarities are also known as equi-form transformations
Similarities preserves the angles and the shapes, while not the length and
the areas.
The ratio between lengths and areas is preserved since the scaling factor
cancels out
Giacomo Boracchi
Similarities : Properties
Similarities have four degrees of freedom: the scaling factor π , the rotation
angle π and the translation vector [π‘π₯ , π‘π¦]
π₯β²π¦β²1
=π cos ππ sin π0
βπ sin ππ cos π0
π‘π₯π‘π¦1
π₯π¦1
Rmk ββ = π»πββΊββ, thus finite points remain finite points
Rmk Similarities can be estimated from two point correspondences
Metric structure means that the structure is preserved up to a scaling
Giacomo Boracchi
Affine Transformation
H =
3.5784 -1.3499 0
2.7694 3.0349 0
0 0 1.0000
det(A) =
14.5985
Giacomo Boracchi
Affinities
Affinities can be written as
πβ² = π»π΄π
where
π₯β²π¦β²1
=
π1,1π2,10
π1,2π2,20
π‘π₯π‘π¦1
π₯π¦1
and π1,1π2,1
π1,2π2,2
is an invertible matrix
Giacomo Boracchi
Affinities
Affinities can be written as
πβ² = π»π΄π
A more compact representation is
π₯β²π¦β²1
=π cos ππ sin π0
β sin πcos π0
π‘π₯
1
π₯π¦1
where
β’ π΄ β β2,2 is an invertible matrix
β’ π β βπ is a translation vector.
Rmk Affinities can be seen as a linear, non singular transformation of
followed by a translation
π΄ ππβΊ
Giacomo Boracchi
Decomposition of Affinities
The linear part of the affine transformation can be seen as the
composition of two fundamental transformations:
β’ rotation
β’ and non-isotropic scaling.
The affine matrix A can always be decomposed
π΄ = π (π) π (βπ)π·π (π)
where π (π) and π (π) are rotations by π and π respectively, and π· is
π· =π10
0π2
Giacomo Boracchi
Decomposition of Affinities
This decomposition can be obtained via πππ· π΄
π΄ = ππ·πβΊ, being ππβΊ = ππβΊ = πΌ2π΄ = π ππβΊ π·πβΊ =
π΄ = ππ πβΊπ·πβΊ
π΄ = π (π) π (βπ)π·π (π)
non-isotropic
scaling.
Giacomo Boracchi
Affinities: Invariants
Due to the non-isotropic scaling, the similarity invariants of length ratios
and angles between lines are not preserved under an affinity.
Affinities preserves
β’ Parallel lines, since ββ = π»π΄ββΊββ
β’ Ratio of lengths over parallel lines
β’ Ratio of areas (since each area is scaled of det(π΄), which cancels out)
Giacomo Boracchi
Affinities: Properties
Similarities have six degrees of freedom: the four terms of π΄ and the
translation vector [π‘π₯ , π‘π¦]
π₯β²π¦β²1
=
π1,1π2,10
π1,2π2,20
π‘π₯π‘π¦1
π₯π¦1
Rmk Similarities can be estimated from four point correspondences
Rmk ββ = π»π΄ββΊββ, thus finite points remain finite points
Giacomo Boracchi
Projective Transformation
H =
-1.0689 -2.9443 0
-0.8095 1.4384 0
0.0100 0.0010 1.0000
det(A) =
-3.9209
Giacomo Boracchi
Homographies
Homographies are the most general transformation in homogeneous
coordinates, and can be written as
πβ² = π»ππ
namely
π₯β²π¦β²1
=π cos ππ sin π0
β sin πcos π0
π‘π₯
π£
π₯π¦1
where π = [π£1; π£2] and π£ β β (possibly zero)
While this transformation applies in β2, it is not always possible to scale
π»π to have π£ = 1, as this might be zero.
π΄ ππβΊ
Giacomo Boracchi
Homographies: Invariants
Homographies generalize an affine transformation, which is the
composition of a general non-singular linear transformation of
inhomogeneous coordinates and a translation.
Invariants: the cross ratio of four collinear points: a ratio of lengths on a
line is invariant under affinities, but not under projectivities. However, a
ratio of ratios or cross ratio of lengths on a line is a projective invariant.
π3 β π1 π4 β π2π3 β π2 π4 β π1
π1
π2
π3π4
Giacomo Boracchi
Homographies: Invariants
The matrix has nine elements with only their ratio significant, so the
transformation is specified by eight parameters
A projective transformation between two planes can be computed from
four point correspondences, with no three collinear on either plane.
Giacomo Boracchi
Homographies: Properties
Similarities have eight degrees of freedom: the four terms of π΄ and the
translation vector [π‘π₯ , π‘π¦]
π₯β²π¦β²1
=π cos ππ sin π0
β sin πcos π0
π‘π₯
π£
π₯π¦1
Rmk Homographies can be estimated from four point correspondences
Rmk ββ β π»πββΊββ when π β π, thus ideal points might become finite
points. For instance given π = π₯1; π₯2; 0 , then
π»ππ =
β¦β¦
π£1π₯ + π£2π¦ + π£0
π΄ ππβΊ
Giacomo Boracchi
Homographies: Properties
Under a projective transformation ideal points may be mapped to finite
points, and consequently ββ is mapped to a finite line.
However, if the transformation is an affinity (π = [0, 0]), then ββ is not
mapped to a finite line, but remains at infinity.
The image of πβ is
π»β1 βΊ πβ
π cos ππ sin π0
β sinπcos π0
π‘π₯
π£
001
=π£1π£2π£
π΄ββΊ π
πββΊπ΄ββΊ
Giacomo Boracchi
Affine Trasformation and Line at Infinity
Rmk: πβ is not fixed pointwise under an affine transformation
Under an affinity a point on πβ (i.e., an ideal point) can be mapped to a
different point on πβ. This is the reason why orthogonality is lost.
Giacomo Boracchi
Summarizing
Hartley Zisserman Tab 2.1
Transformations higher in the
table can produce all the actions
of the ones below
Giacomo Boracchi
Homographies: Properties
For a given affinity the areas are scaled of det π΄ anywhere on the plane;
and the orientation of a transformed line depends only on its initial
orientation, not on its position on the plane.
In contrast, area scaling in homographies varies with position (e.g. under
perspective a more distant square on the plane has a smaller image than
one that is nearer)
Giacomo Boracchi
Points and Planes in β3
A point in β3 is defined as
π = π₯; π¦; π§; 1
The incidence equation for a plane (i.e. π β π) is
ππ₯ + ππ¦ + ππ§ + π = 0
Which can be written in matrix form as
π, π, π, π β π = 0
And this implies that the plane is identified by a vector in β3
π = π; π; π; π
Rmk planes have 3 degrees of freedom, since their equation holds up to a scaling of a parameter
Rmk planes in β3 are plays the same role as lines in β2
π₯
π¦
π§
Giacomo Boracchi
Lines in β3
More difficult to represent.
They have 4 degrees of freedom:
β’ Their direction
β’ The distance from the origin
(along the plane orthogonal to the direction)
Lines in β3 are defined as intersections of two planes
π₯
π¦
π§
Giacomo Boracchi
The Plane at infinity
The plane at infinity has the canonical position
πβ = 0; 0; 0; 1
in affine 3D-space.
πβcontains ideal points (directions) πβ = [π₯; π¦; π§; 0], and enables the
identification of affine properties such as parallelism.
In particular:
β’ Two planes are parallel if and only if their line of intersection is on π β
β’ A line is parallel to another line, or to a plane, if their point of
intersection is on π β
Giacomo Boracchi
Ideal Points in β3
Ideal points in β3 are defined similarly to ideal points in β2
Ideal points are the intersection of parallel lines.
β’ All the parallel lines in the space intersect in the same ideal point πβ
π₯
π¦
π§πβ β πβ
Giacomo Boracchi
Planes in β3 and ideal lines
β’ A plane π contains infinite parallel lines along infinite directions
β’ Each set of parallel lines intersect in an ideal point (belonging to πβ)
β’ All these ideal points lie on the ideal line ββ(π): the line at infinity of π
π΄β β πβ
πΆβ β πβ
π
ββ(π)
π΅β β πβ
Giacomo Boracchi
A set of parallel lines in the world plane intersect
in a point in the image, the vanishing point
π£
Giacomo Boracchi
Vanishing points
Vanishing points are the projection in the image plane of ideal points in
the 3D world
If a line has direction π , then it intersects πβ in the point πβ = [π ; 0]
Then the vanishing point π£ is the image of πβ by means of the camera
matrix π = πΎ[πΌ3, π] (consider the camera center as the origin)
π£ = ππβ = πΎ πΌ3, π β [π ; 0] = πΎπ
Hartley Zisserman Fig.8.14
Giacomo Boracchi
Vanishing points
When π β β along a line, its image converges to π£, which is the
intersection of the image plane with the line passing through πΆ and
directed as π
Hartley Zisserman Fig.8.14
Equally spaced pointsThe spacing among
image points
monotinically
decreases
Giacomo Boracchi
Vanishing points
Vanishing points are the projection in the image plane of ideal points in
the 3D world
Hartley Zisserman Fig.8.14
Giacomo Boracchi
Horizon
Horizon or Vanishing line for a plane π is the image of the line at the
infinity of that plane, ββ(π)
Horizon helps humans to intuitively deduce properties about the image
that might not be apparent mathematically.
We can understand when two lines are parallel in the 3D world, since they
intersect with the horizon
Giacomo Boracchi
Remember!
The horizon line holds for a single plane of the 3D world
When the image contains multiple planes,
there is an horizon line for each of these
And ideal points of lines in a plane
are often not the same of lines on other
planes
Giacomo Boracchi
Affine Rectification
Idea:
β’ Identify the ββ in the image
β’ transform the identified ββ to its canonical position of [0; 0; 1]
Let π = (π1; π2; π3) be the image of the line at the infinity with π3 β 0,
A suitable homography which maps π back to ββ = [0; 0; 1] is
π» = π»π΄
1 0 00 1 0π1 π2 π3
Giacomo Boracchi
Affine Rectification
Idea:
β’ Identify the ββ in the image
β’ transform the identified ββ to its canonical position of [0; 0; 1]
Let π = (π1; π2; π3) be the image of the line at the infinity with π3 β 0,
A suitable homography which maps π back to ββ = [0; 0; 1] is
π» = π»π΄
1 0 00 1 0π1 π2 π3
Rmk: π can be rescaled to improve conditioning of π»
Giacomo Boracchi
Single-View GeometryGiacomo Boracchi
March 3rd, 2020
USI, Lugano
Book: HZ, chapter 2,3
Giacomo Boracchi
Outline
β’ DLT Algorithm for Least Squares Fitting in β2
β’ Homography estimation
β’ Camera Calibration
β’ Applying Point Trasformations to Images
β’ Conics in β2
β’ Conic Fitting
Giacomo Boracchi
DLT
Direct Linear Trasformation (DLT) algorithm, solves many relevant
problems in Computer Vision
β’ 2D Homography estimation
β’ Camera projection matrix estimation (projections from 3D to 2D)
β’ Fundamental matrix computation
β’ Trifocal tensor computation
Giacomo Boracchi
Homography estimation
We consider a set of point correspondences
ππβ², ππ , π = 1,β¦ , 4
belonging to two different images. Our problem is to compute a π» β β3Γ3
such that ππβ² = π»ππ for each π.
Rmk if we look at π as a 3d vector the equality ππβ² = π»ππ does not hold
Equality holds in β2 (but linear systems are solved as in β3).
What makes the DLT is distinct from standard cases since the left and
right sides of the defining equation can differ by an unknown
multiplicative factor which is dependent on the number of equations.
Giacomo Boracchi
DLT for Homography Estimation
In β3, ππβ² and ππ have the same direction, but may differ in magnitude.
Therefore collinearity constraints can be written as
ππβ² Γ π»ππ = π , π = 1,β¦ , 4
where π = [0; 0; 0]
By Acdx - Self-made
Giacomo Boracchi
DLT for Homography Estimation
Let ππ = π₯π; π¦π; π€π and π» = [ππβΊ ; ππ
βΊ ; ππβΊ ] being π1
βΊ
Then the cross product can be written as..
ππβ² Γ π»ππ =
π¦πβ²ππ
βΊ ππ βπ€πβ²ππ
βΊ πππ€πβ²ππ
βΊ ππ β π₯πβ²ππ
βΊ πππ₯πβ²ππ
βΊ ππ β π¦πβ²ππ
βΊ ππ
Giacomo Boracchi
DLT for Homography Estimation
And after some linear algebra, this can be expressed in a matrix form as
πβΊ
π€β²πππβΊ
βπ¦β²πππβΊ
βπ€β²πππβΊ
πβΊ
π₯β²πππβΊ
π¦β²πππβΊ
βπ₯πππβΊ
πβΊ
ππ
ππ
ππ
= 0
This is a 3 Γ 9 matrix multiplied times a vector of 9 elements
Rmk The equation is an equation linear in the unknown vector
π = ππ ; ππ ; ππ
Rmk the three rows of the matrix are linearly dependent (the third row is
the sum of βπ₯π/π€π times the first row and βπ¦π/π€π times the second)
Giacomo Boracchi
DLT for Homography Estimation
Thus, keep only two rows giving rise to an homogeneous linear system
πβΊ
π€β²πππβΊβπ€β²πππ
βΊ
πβΊπ¦β²πππ
βΊ
βπ₯πππβΊ
ππ
ππ
ππ
= π
Which can be written as
π΄ππ = π, π = 1,β¦ , 4
Rmk remember that π has been unrolled row-wise, not column-wise
Giacomo Boracchi
DLT for Homography Estimation
Stacking 4 point correspondences gives an 8 Γ 9 matrix
π΄π = π
We are not interested in the trivial solution π = π
Solve it as π = π ππ(π΄) and arbitrarily imposing π = 1
Giacomo Boracchi
DLT in the overdetermined case
Let us assume π > 4 point correspondences are given, such that π΄ is
a 2π Γ 9 matrix
π΄π = π
The system is overdetermined. We are not interested
β’ in the trivial solution π = π and
β’ not even in an exact solution, since typically this does not exist
because of noise in the measurements ππβ², ππ
Thus, impose the constraint π = 1 and minimize a cost function
πβ = argmin π΄πππ . π‘. π
π= 1
Giacomo Boracchi
DLT in the overdetermined case
The solution of this problem is obtained by
πβ = argmin π΄πππ . π‘. π
π= 1
The solution is the (unit) eigenvector of π΄ππ΄ with least eigenvalue.
Equivalently, the solution is the unit singular vector corresponding to the
smallest singular value of π¨. (See HZ A5.3(p592) )
Specifically, if π΄ = ππ·πβΊ with D diagonal with positive diagonal entries,
arranged in descending order down the diagonal, then π is the last
column of π.
Rmk DLT algorithm minimizes the residual π΄π , which has to be
interpreted as an algebraic error
Giacomo Boracchi
DLT and the reference system
Are the outcome of DLT independent of the reference system being used
to express πβ² and π?
Unfortunately DLT is not invariant to similarity transformations.
Therefore, it is necessary to apply a normalizing transformation to the
data before applying the DLT algorithm.
Normalizing the data makes the DLT invariant to the reference system, as
it is always being estimated in a canonical reference
Normalization is also called Pre-conditioning
Giacomo Boracchi
Preconditioning
Needed because in homogeneous coordinate systems, components
typically have very different ranges
β’ Row and Column indexes ranges in [0 β 4πΎ]
β’ Third component is 1
Define a maping
π₯ β ππ₯
That brings all the points Β«aronud the originΒ» and rescale each component
to the same range (say at an average distance 2 from the origin)
Giacomo Boracchi
Preconditioning
π β ππ
β2 (with π = 0 since we do not need rotations)
π =1/π 00
01/π 0
βπ‘π₯/π βπ‘π¦/π
1
The preconditioning for a set of points π of β2 is defined as
π‘π₯ = mean π(1, : )
π‘π¦ = mean π(2, : )
Which brings the barycentre of π to the origin, the scaling is
π =mean std π, 2
2
Giacomo Boracchi
Homography estimation with preconditioning
Estimate the homography between two sets of points π, πβ²
1. Compute π, πβ preconditioning transformation of π, πβ²
2. Apply transformation
ππ = ππ, ππβ² = πβ²πβ²
1. Estimate the homography from ππ and ππβ² ,
π» = π·πΏπ(ππ , ππβ²)
1. Define the transformation
π»π = πβ²β1π»π
Giacomo Boracchi
Apply the inverse of the desired transformation on a grid covering the output image
H =
-1.0689 -2.9443 0
-0.8095 1.4384 0
0.0040 0.0010 1.0000
Giacomo Boracchi
Bilinear Interpolation
Intensity value over the transformed grid (π₯, π¦)are defined by interpolating values of
neighbouring pixels { π₯π , π¦π , π = 1,2}. Several
interpolation options are viable. Bilinear
interpolation is a weighted average with weights
proportional to the areas illustrated here.
By Cmglee - Own work, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=21409164
Giacomo Boracchi
Bilinear Interpolation
Let (π₯, π¦) be the point and π(π₯, π¦) the value we
want to estimate.
Bilinear interpolation corresponds to
β’ Perform a 1D-linear interpolation along π₯ axis
to estimate π π₯, π¦1 and π π₯, π¦2
π π₯, π¦1 =π₯2 β π₯
π₯2 β π₯1π π₯1, π¦1 +
π₯ β π₯1π₯2 β π₯1
π π₯2, π¦1
π π₯, π¦2 =π₯2 β π₯
π₯2 β π₯1π π₯1, π¦2 +
π₯ β π₯1π₯2 β π₯1
π π₯2, π¦2
β’ Perform 1D-linear interpolation along π¦ axis
but considering π(π₯, π¦1) and π(π₯, π¦2)
By Cmglee - Own work, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=21409164
Giacomo Boracchi
Re-arrange the new estimated values over a regular grid to obtain the transformed image
Giacomo Boracchi
Single-View GeometryGiacomo Boracchi
March 10th, 2020
USI, Lugano
Book: HZ, chapter 2
Giacomo Boracchi
Outline
β’ Implications of image calibration
β’ Camera Center
β’ Viewing Rays
β’ Factorization of π
β’ Conics and Conic Fitting
β’ Comments on Error Minimization
β’ Measuring Angles
β’ Single View Rectification
Giacomo Boracchi
The Camera Center πΆ
The 3D coordinates of the center of a camera having matrix π β β3,4
satisfy
πΆ β π ππ(π)
Where π ππ(β ) denotes the Right Null Space.
Note that when the π ππ(π) has dimension 1 (i.e. always but in
degenerate cases) all the points πΆ β π ππ π coincide in the
homogenous space.
Giacomo Boracchi
The Camera Center πΆ
Proof
Let us consider πΆ β π ππ(π), then
ππ = π π + ππΆ βπ β β, βπ β β3
This means that the line π + ππΆ does not change its projection through
π, thus π + ππΆ is a viewing ray. Since this has to hold βπ β β3, this
means that πΆ is the camera center.
The converse is trivial because given the camera center πΆ, then
π π + ππΆ = ππ βπ β β3 (since π + ππΆ is homogeneous coordinates
is the viewing ray), thus πΆ β π ππ(π)
Giacomo Boracchi
Calibrated Cameras: Viewing Rays Coordinates
We can associate to each point on the image, a viewing ray
π = πΆ + π πΎπ β1π0
Remember that πΆ = π ππ π
XY
ππΆ
Ξ
π
π
π₯
π¦
π
π
π
Giacomo Boracchi
Once Calibrated
We can associate to each point on the image, a viewing ray
π = πΆ + π πΎπ β1π0
In fact
ππ = π πΆ + π πΎπ β1π0
ππ = ππΆ + ππΎ π , π πΎπ β1π0
ππ = π πΎπ ,πΎπ πΎπ β1π0
ππ = ππ = π βπ
Giacomo Boracchi
Once Calibrated: Factorization of π
Once the camera has been calibrated we are want to factorize π as
π = πΎ π , π
where π is a rotation matrix, and πΎ is upper triangular.
By doing so we can:
β’ Compute viewing rays, which requires πΎπ β1
β’ Preserve πΎ when the camera moves, since the intrinsic parameters do
not change and do not need to be estimated from scratches.
Giacomo Boracchi
Factorization of π
For computing viewing rays we need to factorize the matrix π estimated
through camera calibration
π β πΎ[π , π]
Let us write
π = ΰ·©π,ππ
Then we have to find a way to write ΰ·©π = πΎπ , where πΎ is upper triangular
and π is a rotation matrix.
Giacomo Boracchi
Factorization of π
Let us compute the QR-decomposition of ΰ·©πβ1 ( ΰ·©π β β3Γ3)
ΰ·©πβ1 = ΰ·©π ΰ·©π
where ΰ·©π is orthogonal and ΰ·©π is upper triangular. Since
ΰ·©πβ1 = π β1πΎβ1,
Then we need to set
π = det ΰ·©π ΰ·©π βΊ, πΎ = ΰ·©π β1
Since by doing so det π > 0 (we are allowed changing the sign of a
matrix, thus we obtain a rotation and no reflection)
Similarly we can multiply 1
πΎ(3,3)to have 1 in the bottom right entry of πΎ
π = det ΰ·©π πΎβ1ππ
Giacomo Boracchi
Factorization of π
function [K,R,t] = krt (M)
%KRT Internal and external parameters from M
[Q,T] = qr_p(inv(M(1:3, 1:3))); %qr decomposition
yielding positive diagonal values over T, to make
qr factorization unique
s = det(Q);
R = s*Qβ;
t = s*T*M(1:3,4);
K = inv(T./T(3,3));
end
Andrea Fusiello, Elaborazione delle Immagini: Visione Computazionale, ttp://www.diegm.uniud.it/fusiello/index.php/Visione_Computazionale
Giacomo Boracchi
The Coordinate Systems Involved in Camera Projection
Andrea Fusiello, Elaborazione delle Immagini: Visione Computazionale, http://www.diegm.uniud.it/fusiello/index.php/Visione_Computazionale
[π , π]
World 3D
reference
system
[meters]
Camera 3D
reference
system
[meters]
2D Normalized
Coordinates
[meters]
Image
Coordinates
[pixels]
Giacomo Boracchi
Conics
By Pbroks13 - Own work, CC BY 3.0, https://commons.wikimedia.org/w/index.php?curid=5919064
Giacomo Boracchi
Conics in β2
A conic is a curve described by a second-degree equation in the plane.
In Euclidean coordinates a conic becomes
ππ₯2 + ππ₯π¦ + ππ¦2 + ππ₯ + ππ¦ + π = 0
π₯ β π₯1/π₯3, π¦ β π₯2/π₯3 gives
ππ₯12 + ππ₯1π₯2 + ππ₯2
2 + ππ₯1π₯3 + ππ₯2π₯3 + ππ₯32 = 0
or in matrix form
πβΊπΆπ = 0
where the conic coefficient matrix C is given by πΆ =
π π/2 π/2π/2 π π/2π/2 π/2 π
Giacomo Boracchi
Conics in β2
πβΊπ π/2 π/2π/2 π π/2π/2 π/2 π
π = 0
Rmk The conic coefficient matrix is symmetric,
Rmk multiplying C by a non-zero scalar does not change. Only the ratios
of the elements in πΆ are important, as for homogeneous points and for
lines.
Rmk The conic has five degrees of freedom :
β’ the ratios {a : b : c : d : e : f} or equivalently
β’ the six elements of a symmetric matrix less one for scale.
Giacomo Boracchi
Conic fitting
Five points define a conic.
Let π = [π₯π; π¦π] β β2 a point belonging to a conic
ππ₯π2 + ππ₯ππ¦π + ππ¦π
2 + ππ₯π + ππ¦π + π = 0
To determine the conic coefficients we need five such equations in π =π, π, π, π, π, π β², since the conic is determined up to a scaling factor.
In matrix expression
π₯π2, π₯ππ¦π , π¦π
2, π₯π , π¦π , 1 π = 0
We re-arrange the first term as a matrix, the solution to solve is
Giacomo Boracchi
Conic fitting
π₯12, π₯1π¦1, π¦1
2, π₯1, π¦1, 1
β¦
π₯π2 , π₯ππ¦π, π¦π
2 , π₯π, π¦π, 1
π = 0,
π. π., π΄π = 0
Rmk: The system is π΄ β βπΓ6, solved by π β π ππ π΄ when π = 5
Unique solution, when N= 4 the π ππ has dimension larger than one, any
of the vectors in π ππ(π) is a solution
Giacomo Boracchi
Conic fitting
π₯12, π₯1π¦1, π¦1
2, π₯1, π¦1, 1
β¦
π₯π2 , π₯ππ¦π, π¦π
2 , π₯π, π¦π, 1
π = 0,
π. π., π΄π = 0
Rmk: The conic identified by π is the same as the one from ππ
So, when π > 5 we are interested in solving
πβ = argmin π΄πππ . π‘. π
π= 1
Giacomo Boracchi
Lines tangent to a conic
Theorem The line π tangent to πΆ at a point π on πΆ is given by π = πΆπ.
Proof (HZ result 2.7)
he line π = πΆπ passes through π, since πβΊπ =πβΊπΆπ = 0. So, π has at least one contact with the conic.
Now we prove that π is the only point belonging to both π and πΆ, thus π is
the tangent in π.
Suppose that π meets the conic in another point π, such that πβΊπΆπ = 0and πβΊπ = 0. This also implies πβΊπ = πβΊπΆ π = πβΊπΆπ = 0. Then
π + πΌπ βΊπΆ(π + πΌπ) = 0 for all πΌ, which means that the line π = πΆπjoining π and π lies on the conic πΆ, which is therefore degenerate.
Giacomo Boracchi
DLT and Error minimization
DLT algorithm minimizes the algebraic residual:
πβ = argmin π΄πππ . π‘. π
π= 1
This does not have a physical meaning being π΄ (in case of homography
estimation) made of rows like
πβΊ
π€β²πππβΊβπ€β²πππ
βΊ
πβΊπ¦β²πππ
βΊ
βπ₯πππβΊ
The norm of π΄π does not admit a straightforward geometric interpretation
Giacomo Boracchi
DLT and Error minimization
It would be better to measure the re-projection error, which has a physical
meaning and refers to metric quantities (e.g. cm)
1
π
π
ππβ² βπ»ππ 2 + ππ βπ»β1ππβ² 2
Provided the set of pairs ππβ², ππ , π = 1,β¦ ,π
This indicates how far the mapped points are to the destination.
However, minimizing this error is non trivial.
Rmk. If we take only 4 pairs of points, the algebraic and geometric error is
zero
Giacomo Boracchi
DLT and Error minimization
It would be better to measure the re-projection error, which has a physical
meaning and refers to metric quantities (e.g. cm)
1
π
π
ππβ² βπ»ππ 2 + ππ βπ»β1ππβ² 2
Provided the set of pairs ππβ², ππ , π = 1,β¦ ,π
This indicates how far the mapped points are to the destination.
However, minimizing this error is non trivial.
Rmk. If we take only 4 pairs of points, the algebraic and geometric error is
zero
Giacomo Boracchi
The standard procedure
1. Estimate the homography π» by minimizing the Algebraic error (e.g.
through DLT)
2. Refine the estimated homography by minimizing the geometric error
through a numerical solver
β’ In this latter step, use π» as an initial guess for the nonlinear minimization
Giacomo Boracchi
Dual conics (conics envelopes)
Conics are defined by point equations
πβΊπΆπ = 0
However, point-line duality makes it possible to define conics by lines
A line π tangent to the conic πΆ satisfies
πβΊπΆβπ = 0
where πΆβ is the adjoint of πΆ which in case of symmetric and non-singular
matrix is πΆβ = πΆβ1
Giacomo Boracchi
Homographies and lines and conics
An homography transform each point π in a point πβ² such that:
π β π»π = πβ²
An homography transform each line π in a line πβ² such that:
π β π»β1 βΊ π = πβ²
An homography transform each conic πΆ in a conic πΆβ² such that:
πΆ β π»β1 βΊπΆπ»β1 = πΆβ²
An homography transform each dual (line) conic πΆβ in a dual conic πΆββ²
πΆβ β π»πΆβπ»βΊ = πΆββ²
We say that points transform contravariantly and lines and conics
transform covariantly.
Giacomo Boracchi
Degenerate Conics
When the matrix πΆ is not of full rank, a point conic πΆ degenerates in
β’ two lines (πΆ has rank 2),
β’ or a repeated line (πΆ has rank 1)
A line conic πΆβ degenerates in
β’ two points (πΆβ has rank 2),
β’ a repeated point (πΆβ has rank 1)
For instance, πΆβ such that rank(πΆβ) = 2
πΆβ = ππβΊ + ππβΊ
Is the set of all the lines passing through π and π (not the that πΆβ
remains a 3 Γ 3 matrix)
Giacomo Boracchi
Circular Points: π° and π±
These are very special points in πβ
π° =1π0
, π± =1βπ0
These are called circular points since they correspond to the intersection
of any circle with πβ
Rmk a circle can be fit through 3 points. Or can be fit as a general conic
passing through 3 points + the two circular points
ββ
π±π°
Giacomo Boracchi
Circular Points: π° and π±
Circular points are fixed under an orientation-preserving similarity
π»ππ° = π°, π»ππ± = π±
a reflection instead swaps π° and π±
Rmk circular points are not fixed under projective transformations
Giacomo Boracchi
Conic dual to circular points: πΆββ
πΆβ
πΆβ = ππβΊ + ππβΊ
F0r which rank(πΆβ) = 2 and is the set of all the lines passing through πand π (note the that πΆβ remains a 3 Γ 3 matrix)
We can compute the dual conic associated to circular points
πΆββ = π°π±βΊ + π±π°βΊ
which also is a degenerate line conic
π° =1π0
, π± =1βπ0
β πΆββ =
1 0 00 1 00 0 0
Giacomo Boracchi
Conic dual to circular points: πΆββ
Property πΆββ is fixed under an orientation-preserving similarity
Property πΆββ in the Euclidean plane can be written as
πΆββ =
1 0 00 1 00 0 0
Therefore, any homography transforms πΆββ like any other line conic
πΆββ β πΆβ
β β² = π»πΆββ π»βΊ
In an image, the equations of πΆββ β² might be different from
1 0 00 1 00 0 0
Giacomo Boracchi
Single Image Rectification
Affine rectification: find the homography π»π that sends πβ in its canonical
equation [0; 0; 1].
Metric rectification: after applying π»π, determine an affine transformation
π»π΄ that maps circular points back to their canonical position [1;Β±π; 0].
β’ Any similarity transformation applied next would not change the
location of circular points
Rmk it is enough to find an homography that brings πΆββ β² in
1 0 00 1 00 0 0
Giacomo Boracchi
Single Image Rectification
Important Property after an affine rectification, πΆββ β² can be written as
πΆββ β² = π΄π΄βΊ π
πβΊ 0
Being π΄ a 2 Γ 2 invertible matrix (cfr HZ example 2.26)
(this is the image of the canonical πΆββ through an affine transformation
since similarities do not change πΆββ , and that projective transformation
has been removed by the affine rectification)
Giacomo Boracchi
Single Image Rectification (after affine rectification)
Our goal is to estimate that π» in order to define the inverse mapping π»β1
Assume now that that affine rectification has been already performed
πΆββ =
1 0 00 1 00 0 0
πΆββ β² = π΄π΄βΊ π
πβΊ 0
π»
Giacomo Boracchi
Single Image Rectification
Our goal is to estimate that π» in order to define the inverse mapping π»β1
πΆββ =
1 0 00 1 00 0 0
Rectification can achieved by estimating πΆββ β² (in this case π΄π΄βΊ) in the image
πΆββ β² = π΄π΄βΊ π
πβΊ 0
π»
Giacomo Boracchi
Single Image Rectification provided πΆββ β²
1. Perform affine rectification, such that πβ = [0; 0; 1]
2. Fit an ellipse to πΎβ² the image of a circle πΎ
3. Compute π°β², π±β² by intersecting πΎβ² with πβ
4. We have πΆββ β² = π°β²π±β²βΊ + π±β²π°β²βΊ
πΎπΎβ²
Giacomo Boracchi
Single Image Rectification provided πΆββ β²
1. Perform affine rectification, such that πβ = [0; 0; 1]
2. Fit an ellipse to πΎβ² the image of a circle πΎ
3. Compute π°β², π±β² by intersecting πΎβ² with πβ
4. We have πΆββ β² = π°β²π±β²βΊ + π±β²π°β²βΊ
πΎπΎβ²
πΎβ² β© πβ
π°β²
π±β²
Giacomo Boracchi
Single Image Rectification provided πΆββ β²
The SVD of πΆββ β² can be used to define the rectifying homography
transformation.
In fact, up to a similarity transformation that rescales eigenvalues we
obtain πΆββ !
πππ· πΆββ β² = π
1 0 00 1 00 0 0
πβΊ
So, it is enough to take π to rectify the image, since the similarity
transformation does not affect πΆββ
Giacomo Boracchi
Recap: Angles in the Euclidean Plane
In Euclidean geometry the angle between two lines is computed from the
dot product of their normals. For the lines π = (π1; π2; π3), and π =(π1;π2;π3), the angle π is such that
cos π =π1π1 + π2π2
π12 + π2
2 (π12 +π2
2)
We will see later interesting properties on projective plane
Giacomo Boracchi
Recap: Angles in the Euclidean Plane
In Euclidean geometry the angle between two lines is computed from the
dot product of their normals. For the lines π = (π1; π2; π3), and π =(π1;π2;π3), the angle π is such that
cos π =π1π1 + π2π2
π12 + π2
2 (π12 +π2
2)
We will see later interesting properties on projective plane
Time has come!
Rmk the first two components of π and π do not have a pre-defined
meaning in β2
Giacomo Boracchi
Angles in the Projective Plane
An analogous expression, that is invariant to projective transformation, for
the angle π between lines π = (π1; π2; π3) and π = (π1;π2;π3), is
cos π =πβΊπΆβ
β π
πβΊπΆββ π (πβΊπΆβ
β π)
Rmk when πΆββ =
1 0 00 1 00 0 0
and we are in homogeneous coordinates. The
system the above equation becomes the same as in the previous slide
Giacomo Boracchi
Angles in the Projective Plane
Rmk it is easy to verify that
cos π =πβΊπΆβ
β π
πβΊπΆββ π (πβΊπΆβ
β π)
is invariant w.r.t. any projective transformation π»definition for an angle
(just replace π β π»β1 βΊπ, and πΆβ β π»πΆβπ»β1)
Rmk the image of two orthogonal lines πβ²,πβ² have to satisfy
πβ²βΊπΆββ β²πβ² = π
Giacomo Boracchi
Single Image Rectification from orthogonal lines
ππ
πβ²
πβ²
Let πβ²,πβ² be the images of two orthogonal lines π and π in the 3D space
πΆββ =
1 0 00 1 00 0 0
πΆββ β² = ?
π»
Giacomo Boracchi
Single Image Rectification from orthogonal lines
If πβ² and πβ² are images two orthogonal lines π and π (in the 3D world),
then it has necessarily to hold
πβ²βΊπΆββ β²πβ² = 0
Let us use this information to compute πΆββ β², thus compute π»
Remember that, after an affine rectification
πΆββ β² = π΄π΄βΊ π
πβΊ 0
and that π = π΄π΄βΊ is a symmetric homogeneous matrix π΄π΄βΊ = π΄βΊπ΄ , thus
there are only 2 unknowns to identify πΆββ β²
Each pair of orthogonal lines yield a single equation
πβ² 1: 2 βΊπ πβ²(1: 2) = 0
Giacomo Boracchi
Single Image Rectification from orthogonal lines
If πβ² and πβ² are images two orthogonal lines π and π (in the 3D world),
then it has necessarily to hold
πβ²βΊπΆββ β²πβ² = 0
Let us use this information to compute πΆββ β², thus compute π»
Remember that, after an affine rectification
πΆββ β² = π΄π΄βΊ π
πβΊ 0
and that π = π΄π΄βΊ is a symmetric homogeneous matrix π΄π΄βΊ = π΄βΊπ΄ , thus
there are only 2 unknowns to identify πΆββ β²
Each pair of orthogonal lines yield a single equation
πβ² 1: 2 βΊπ πβ²(1: 2) = 0
Two pairs of orthogonal lines are enough to identify πΆββ β²
Giacomo Boracchi
Stratified Rectification from Orthogonal Lines
πβ² 1: 2 βΊπ πβ²(1: 2) = 0
Two pairs of (different, i.e. not parallel) orthogonal lines are enough to
estimate π, (thus π΄ through Choleski decomposition)
Hartley Zisserman Fig.2.17
Giacomo Boracchi
Rectification from 5 pairs of orthogonal lines
Assume no affine rectification has been done before
In principle, any pair of lines πβ²,πβ² that in the scene are orthogonal
provides a single equation
πβ²βΊπΆββ β²πβ² = 0
This is a linear constraint in the entries of πΆββ β² (this is exactly like fitting a
conic through 5 points).
Five of these equations are enough to set up a linear system
π΄π = 0
where π contains the six parameters of the conic. The solution is:
π = π ππ(π΄)
Giacomo Boracchi
Rectification from 5 pairs of orthogonal lines
Now the pairs of lines
(highlighted by solid white
lines) can also be parallel
in the 3D world (like the
windows here), since
affine rectification has not
been performed, yet.
Hartley Zisserman Fig.2.17
Giacomo Boracchi
Rectification from 5 pairs of orthogonal lines
Now the pairs of lines
(highlighted by solid white
lines) can also be parallel
in the 3D world (like the
windows here), since
affine rectification has not
been performed, yet.
Hartley Zisserman Fig.2.17
Giacomo Boracchi
Normal to the horizon
Let π = πΎ[π , π] be the projection matrix of a calibrated camera, the
normal π to the plane of an horizon πβ in the image is:
π = πΎππβ
C
π
lhoriz
Οlβ
Ο'
Giacomo Boracchi
Normal to the horizon
Let π = πΎ[π , π] be the projection matrix of a calibrated camera, the
normal π to the plane of an horizon πβ in the image is:
π = πΎππβ
C
π
lhoriz
Οlβ
Ο'Once the camera is calibrated we can
compute the 3D orientation of any plane
for which we see the horizon
Giacomo Boracchi
Angle between vanishing points
Let π£1 and π£2 be the vanishing points of two directions π1 and π2, then
cos π =π1 β π2
π1 π2
And the same can be also computed from the vanishing points
cos π =π£1βΊππ£2
π£1βΊππ£1 π£2
βΊππ£2
C
d1
v2
v1d2
πx1β
x2β
Giacomo Boracchi
Angles between two vanishing points
Let π£1 and π£2 be the vanishing points of two lines (having ideal points
π1β and π2β), and let
π = πΎπΎβΊ β1
Then If π is the angle between the two line directions, then
cos π =π£1βΊππ£2
π£1βΊππ£1 π£2
βΊππ£2
Giacomo Boracchi
Angles between two planes
Let π1 and π2 be the horizon of planes having normal π1 π2
Then, the angle between the planes is
cos π =π1 β π2
π1 π2
cos π =π1βΊπβ1π2
π1βΊπβ1π1 π2
βΊπβ1π2
Giacomo Boracchi
Camera Calibration from Vanishing Points
Vanishing points are images of points at infinity, and provide orientation
information as fixed stars.
Ideal points are part of the scene and can be used as references. Their
position in the image (i.e. the vanishing points) depend only on the
camera rotation.
Giacomo Boracchi
Calibration From 3D Orthogonal Vanishing Points
Note that any pair of vanishing point π£1, π£2 corresponding orthogonal
lines in the image yields a scalar equation in π
π£1βΊππ£2
π£1βΊππ£1 π£2
βΊππ£2= 0
π£1βΊππ£2 = 0
The matrix π is symmetric (π = πΎπΎβΊ β1), thus 5 unknonwns
π =
π€1 π€2 π€4
π€2 π€3 π€5
π€4 π€5 π€6
If the camera has zero skew π€2 = 0
If pixels are squared π€3 = π€1
Giacomo Boracchi
Calibration From 3D Orthogonal Vanishing Points
The matrix π is symmetric for a squared pixel and zeros-skew camera
π =π€1 0 π€4
0 π€1 π€5
π€4 π€5 π€6
This has 4 unknowns (up to a scalar factor) -> three pairs of orthogonal
lines can be used to compute π
Once π has been computed, πΎ can be obtained by Cholesky factorization
Giacomo Boracchi
Recap
β’ Implications of image calibration
β’ Camera Center
β’ Viewing Rays
β’ Factorization of π
β’ Conics and Conic Fitting
β’ Comments on Error Minimization
β’ Measuring Angles
β’ Single View Rectification
Next Class, Epipolar Geometry
π₯ π₯β²
π
πΆβ²πΆ
π πβ²
π
π πβ²