projective geometry and transformations
Post on 26-Feb-2018
251 Views
Preview:
TRANSCRIPT
-
7/25/2019 Projective Geometry and Transformations
1/37
2-1Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
Chapter 2
Projective Geometry
and TransformationsVersion 08.05.2015
-
7/25/2019 Projective Geometry and Transformations
2/37
2-2Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
Content
2.1 Basics of Projective Geometry
2.1.1 Euclidean geometry and beyond
2.1.2 Affine Geometry
2.1.3 Projective Geometry
2.1.4 Projective vs. Affine Interpretations
2.1.5 Inhomogeneous Representations
2.2 Two-dimensional Projective Space
2.2.1 Representation of Points
2.2.2 The World Coordinate System
2.2.3 Homogeneous Coordinates
2.2.4 Euclidean Transformations - Translation , Rotation and Scaling
2.2.5 Projective Transformations - Projectivity
2.2.6 Lines
2.2.7 Points and Lines at Infinity
2.2.8 Duality of Points and Lines
2.2.9 More on Transformations
2.2.10 Specialized Transformations in 2D
2.3 Three-dimensional Projective Space
2.3.1 Points2.3.2 Planes
2.3.3 Transformations in 3D
Table of Contents
-
7/25/2019 Projective Geometry and Transformations
3/37
2-3Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
2.1 Basics of Projective Geometry
Introduction
Euclid, 300 BC, also known asEuclid of Alexandria, was a Greek
mathematician, often referred to as the "Father ofGeometry
Euclid deduced the principles of what is now called Euclideangeometryfrom a small set of axioms
Euclid also wrote works onperspective,conic sections,spherical
geometryandnumber theory
Euclid stated a very intuitive understanding of forms, eg. Plane
Geometry:
1. One point to another form a straight line
2. Extension of a straight line stays straight
3. A circle is described by its radius and centre point
4. Any right angle is a right angle5. The parallel postulate: Two straight lines are parallel when a third
line intersects one line of them perpendicular and the second will
be intersect perpendicular, too.
Or: If a straight line falls on two straight lines and the interior
angles on the same side are less than two right angles, the two
straight lines will definitely intersect on this side.
2.1.1 Euclidean geometry and beyond
http://de.wikipedia.org/wiki/Euklid
http://en.wikipedia.org/wiki/Euclidhttp://en.wikipedia.org/wiki/Parallel_postulate
http://de.wikipedia.org/wiki/Euklidhttp://en.wikipedia.org/wiki/Euclidhttp://en.wikipedia.org/wiki/Parallel_postulatehttp://en.wikipedia.org/wiki/Parallel_postulatehttp://en.wikipedia.org/wiki/Euclidhttp://de.wikipedia.org/wiki/Euklid -
7/25/2019 Projective Geometry and Transformations
4/37
2-4Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
2.1 Basics of Projective Geometry
Cartesian Coordinate System
At least known from secondary school, Euclidean space/geometry
uses several forms of coordinates. The most prominent is the
Cartesian coordinate system. For example it states a 2- and 3-dimensional point P as
Transformations
The group of Euclidean transformations consists of translation,
rotation,reflection,scaling
Euclidean, Elliptical and Hyperbolic Geometry As long curvature is excluded theorems of Euclid. geometry hold true
The 5th postulate mentioned before loses its validity as soon as
curvature (i.e. hyperbolic, elliptical) is introduces.
Such spaces are called non-Euclidean.
Hyperbolic geometry after Lobatschewski is widely used in
astrophysics, as they are basis ofEinsteinstheory of relativity.
Both, hyperbolic and elliptical are important in differential
geometry.
The diagrams show how the sum of the inner angles of a triangle isrelated to the curvature of its underlying 3-dimensional space.
Invariant Properties
The transformationsin any geometry (e.g. Euclidean, hyperbolic,
elliptical, affine, projective, ...) form a group which turn out to be
invariant to certain properties:
In Euclidean geometry the group of movements is invariant to
lengthandarea(isogonal).
2.1.1 Euclidean geometry and beyond
(2D)
xP ,
y
(3D)
x
P y .
z
Euclidean Geometry specialised form of describing a N-dimensional space without
curvature.
-
7/25/2019 Projective Geometry and Transformations
5/37
2-5Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
2.1 Basics of Projective Geometry
Introduction
Affine geometryis ageneralisationof the Euclidean geometry.
The parallel postulate holds true
BUT measures of distance and angles are foreign to affine
geometry.
Affine geometry is the study of parallel lines.
The affine geometry can be described with (freely interpreted)
incidences axioms as follows:
1. Through two points there is only one straight line intersecting
2. On every straight line there lie at minimum two points
3. The parallel relation is reflexive, symmetric and transitive
4. Through every point there is a straight line which is parallel to agiven one
5. A triangle ABC is given. If two pointsA and Bwhich have the
property ofAB||ABexists, then there is one pointCwhich leads
toAC||ACandBC||BC.
Transformations
Transformations from Euclidean Geometry
Shearing
Invariant Properties
Parallelism of lines,area ratios,line at infinity
2.1.2 Affine geometry
Reflexive
A straight line is g||g
Symmetric
If g is mirrored to a line,then g is parallel to g
Transitive
If g||h and g||f, then f||h
Euclidean Geometry
lines are parallel
circles are circles
Affine Geometry
lines are parallel
angles are distorted
circles are ellipses
-
7/25/2019 Projective Geometry and Transformations
6/37
2-6Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
2.1 Basics of Projective Geometry
Introduction
Perspective geometry is a generalisation of Affine and Euclidean
geometry E A P.
Geometry in strict sense describes what kind of transformations are
invariant to a geometric primitive or feature.
In Euclidean space a translation of a cube will definitely be a cube
again. Think of throwing a dice, any rotation or translation will not
affect the feature of the dice intuitively.
In projective geometry only lines are preserved, no angles nor
length. The best way to think of projective space is a 3D-sketch
on paper of a dice. So what we describe is a (in Euclidean
geometry) degenerated dice yet not in projective space.
To work with projective geometry, one uses homogeneous
coordinates.
Transformations
Transformations from Affine Geometry
Perspective Transformation
Invariant Properties
Intersection and tangency
2.1.3 Projective Geometry
lines are parallel
angles are distorted
circles are ellipses
lines are lines
circles are general
(green circle doesnt fit)
-
7/25/2019 Projective Geometry and Transformations
7/372-7Professur Digital- und Schaltungstechnik
Prof. Dr.-Ing. Gangolf HirtzComputer Vis ion
Version 08.05.2015
2.1 Basics of Projective Geometry
Although it is quite common to watch perspective distortions, one can
also discover affine effects on occation
2.1.4 Projective vs. Affine Interpretations
-
7/25/2019 Projective Geometry and Transformations
8/372-8Professur Digital- und Schaltungstechnik
Prof. Dr.-Ing. Gangolf HirtzComputer Vis ion
Version 08.05.2015
2.1 Basics of Projective Geometry
Introduction
Cartesian coordinates have difficulties by representing ideal points
such asinfinitywith finite coordinates.
In projective geometry one uses homogeneous coordinates hence, normal representation is also called inhomogeneous
coordinates
2.1.5 Inhomogeneous Representations
-
7/25/2019 Projective Geometry and Transformations
9/372-9Professur Digital- und Schaltungstechnik
Prof. Dr.-Ing. Gangolf HirtzComputer Vis ion
Version 08.05.2015
A pointp can be represented in of 2D and 3D coordinates as
follows:
Any point consists ofncomponents, which represent one dimension
each. In this example we call them p1, p2and p3, repectively.
Since this seems to be well known, let us find out more about the
meaning behind this notation! Let us consider an example:
Now try to plot these points in the right pictureAny idea?
Since every point representation is only valid with an coordinate
frame addicted to it, it is necessary to define some coordinate frame
for our points:
Having this information, you are able to plot the points, with respectto their coordinate frames
2.2 Two-dimensional Projective Space
2.2.1 Representation of Points
122
D
p
p
p
1
23
3
D
p
p pp
1
5
2
p2
8
4
p
1( , )
( , )
5
2i j
i j
p 2( , )( , )
8
4k l
k l
p
-
7/25/2019 Projective Geometry and Transformations
10/372-10Professur Digital- und Schaltungstechnik
Prof. Dr.-Ing. Gangolf HirtzComputer Vis ion
Version 08.05.2015
A Coordinate System represents a n-dimensional space in the form
of a bunch of coordinatebasis vectors
frame 1: basis vectoriandj
frame 2: basis vectorkandl
Representing a pointp having components p1and p2let us say with
respect to the frame 1, means to stretch the basis vectors iandj by
the scalar values of p1and p2respectivly:
Now lets define some properties for our coordinate frame Frame 1 defines ourworld coordinate system (WCS), which
means that its origin is thezero-vector
The basis vectorsi and j are orthogonal to each other and both
have unit lengthhence they are orthonormal
Since the two basis vectors are orthogonal to each other we resist
in the euclidean 2-dimensional space
With the knowledge of some basics of Linear algebra one can rewrite
the representation of our pointpas
with theIdentity matrixrepresenting our WCS.
2.2 Two-dimensional Projective Space
2.2.2 The World Coordinate System
Some remarks
Notice that the Identity itself is provided with respect to our world
coordinate Frame
What about frame 2 or any other frame one likes to define?: Ones a
WCS is defined, any other frame is expressed with respect to it. We
will come back to this later.
Since now every pointp will be defined implicitly with respect to theWCS.
The Origin of the WCS is usually marked withOW.
The same investigations can be made for the 3- or n-dimensional
spacewithout exception.
If not explicitly mentioned, the representation of any vector relates to
the WCS.
,
1
1 2,
2
pp p
p
i j
i jp i j
1
1 22
1 0with ,
0 1W W WW
pp p
p
p i j i j
1
2
1 0
0 1W
W
p
p
p
-
7/25/2019 Projective Geometry and Transformations
11/37
2-12Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
Introduction
An arbitrary point p of the n-dimensional projective space is
described by homogeneous coordinates of vector size (n+1)
x, y, z... Vector components that stretches coordinate frame
vectors
w...scaling factor
To have a projection comparable to the Euclidean spacew=1 such:
Examples:
2.2 Two-dimensional Projective Space
2.2.3 Homogeneous Coordinates
(2D) (3D),
p p
xx
yy
zw
w
homogeneous Cartesian
(2D)
1
/
/w
xx w x
yy w y
w
p
2 4 82 4 / 2 8 / 4
2.5 5 102.5 5 / 2 10 / 4
1 2 4
h i
p p
-
7/25/2019 Projective Geometry and Transformations
12/37
2-13Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
2.2 Two-dimensional Projective Space
Homogeneous Representation
The origin of a n-dimensional space must not be at w=0:
Points with x(n+1)=0 are ideal points orpoints at infinity and they
cantbe represented in Cartesian coordinates.
A homogeneous coordinate system allows to clearly describe the
position of a finite and infinite point in the projective space.
This coordinates allow to describe a projective transformation via a
transformation matrix as homomorphism (i.e. structure-preserving
map)
So collineation and projection can be represented as linear
transformations.
Formulas with homogenous coordinates are often simpler and more
symmetric than their Cartesian counterparts
2.2.3 Homogeneous Coordinates
Mappings from one to the other coordinate system (withx(n+1)0):
0 0
0 0
O ; O
0 0
0 w
1 2
1 1 1
homogeneousT T T
1 2 1 2 1 1 2
Cartesian/inhomogeneousT T T
1 2 1 1 2
( , , , ) ( , , , , ) ( , , , ,1)
( , , , , ) ( , , , ) ( , , , )nn n n
n n n n
xx x
n n n x x x
x x x x x x x x x x
x x x x x x x
-
7/25/2019 Projective Geometry and Transformations
13/37
2-14Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
Translation
Given a pointpit is possible to translate or better move it by another
vector say the translation vectort:
Rotation
A pointp1can be rotated around the origin by an angle in issueing
a so called rotation matrixR:
Remark: Since in the 3D case, there are three axes to rotate around,
the rotation matrix is a little bit more complex and issues three angles
itself:,and.
Scaling
A pointp2can be scaled up/down by an arbitray factor s, to vary the
size of the vector, but do not change its direction:
This can be rewritten to comply to a matrix notation of s:
2.2 Two-dimensional Projective Space
2.2.4 Euclidean Transformations - Translation , Rotation and Scaling
1 1
1
2 2
p t
p t
p p t
2 1
cos sinwith
sin cos
p R p R
3 2s p p
3 2
0
0
s
s
p p
-
7/25/2019 Projective Geometry and Transformations
14/37
2-15Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
Concatination of Transformations
Assume that we wanted to perform all the transformations
(translation, rotation and scaling) in one single transformationH:
The more operations are concatenated, the more complicated the
computation
As Solution one can use Homogeneous Coordinates:
2.2 Two-dimensional Projective Space
2.2.4 Euclidean Transformations - Translation , Rotation and Scaling
Euclidean Transformation Matrix H
2 1
2 1
21 11 12 11 12 11 1
22 21 22 21 22 12 2
p s s r r p t
p s s r r p t
p H p
p s R p t
2 1 1 ?????? p R R p t t t p
2 1
2 1
21 11
22 12
1
1
1 2
with1
1 1
p p
p p
p H p
p s R p t
s R tH H
0
p H p
11 12 13
3 3 21 22 23
11 12 13 14
21 22 23 24
4 4
31 32 33 34
2D Space:
0 0 1
3D Space:
0 0 0 1
x
x
h h h
h h h
h h h h
h h h h
h h h h
H
H
-
7/25/2019 Projective Geometry and Transformations
15/37
2-16Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
2.2 Two-dimensional Projective Space
2.2.4 Euclidean Transformations - Translation , Rotation and Scaling0001 % Use the following 2-by-11 matrix to draw a simple house
0002
0003 X = [ -6 -6 -7 0 7 6 6 -3 -3 0 0
0004 -7 2 1 8 1 2 -7 -7 -2 -2 -7 ];
0005 no_pts = size(X, 2);
0006 h1 = figure(1), plot(X(1, :), X(2, :), 'ob'), hold on;
0007 title('A Simple House', 'FontWeight', 'bold', 'FontSize', 12);
0008
0009 for i=1:no_pts
0010 x1 = X(:, i);
0011 x2 = X(:, mod(i, no_pts) + 1);
0012 plot([x1(1) x2(1)], [x1(2) x2(2)], '-b')0013 end
0014
0015 % Make Points homogeneous
0016 X = [X; ones(1, size(X, 2))];
0017
0018 % Scaling
0019 H1 = [1/2 0 0;
0020 0 1 0;0021 0 0 1];
0022
0023 % Rotation
0024 H2 = [ 0.7071 -0.7071 0;
0025 0.7071 0.7071 0;
0026 0 0 1];
0027
0028 % Translation
0029 H3 = [ 1 0 2;
0030 0 1 -3;
0031 0 0 1];
0032
0033 % Scaling, Mirroing0034 H4 = [1/2 0 0;
0035 0 -1 0;
0036 0 0 1];
0037
0038 disp(H1); disp(H2); disp(H3); disp(H4);
0039
0040 % Apply Transformation
0041 X1 = H1*X;
0042 X2 = H2*X;
0043 X3 = H3*X;
0044 X4 = H4*X;
0045 disp(X1); disp(X2); disp(X3); disp(X4);
0046
0047 % Make Coordinates inhomogeneous
0048 X1 = bsxfun(@rdivide, X1(1:2, :), X1(3, :));
0049 X2 = bsxfun(@rdivide, X2(1:2, :), X2(3, :));
0050 X3 = bsxfun(@rdivide, X3(1:2, :), X3(3, :));
0051 X4 = bsxfun(@rdivide, X4(1:2, :), X4(3, :));
0052
0053 X1 = X1(1:2, :);
0054 X2 = X2(1:2, :);
0055 X3 = X3(1:2, :);
0056 X4 = X4(1:2, :);
00570058 % Plot Transformed Houses
0059 h2 = figure(2)
0060 plot(X1(1, :), X1(2, :), 'or'); hold on;
0061 plot(X2(1, :), X2(2, :), 'og'); hold on;
0062 plot(X3(1, :), X3(2, :), 'om'); hold on;
0063 plot(X4(1, :), X4(2, :), 'oc'); hold on;
0064 title('Some Simple Transformations', 'FontWeight', 'bold', 'FontSize
0065 legend('Scaling', 'Rotation', 'Translation', 'Scaling/Mirroring');0066
0067 for i=1:no_pts
0068
0069 x1 = X1(:, i);
0070 x2 = X1(:, mod(i, no_pts) + 1);
0071 plot([x1(1) x2(1)], [x1(2) x2(2)], '-r');
0072
0073 x1 = X2(:, i);
0074 x2 = X2(:, mod(i, no_pts) + 1);
0075 plot([x1(1) x2(1)], [x1(2) x2(2)], '-g');
0076
0077 x1 = X3(:, i);
0078 x2 = X3(:, mod(i, no_pts) + 1);0079 plot([x1(1) x2(1)], [x1(2) x2(2)], '-m');
0080
0081 x1 = X4(:, i);
0082 x2 = X4(:, mod(i, no_pts) + 1);
0083 plot([x1(1) x2(1)], [x1(2) x2(2)], '-c')
0084 end
0085 axis equal
0086
0087 print(h1, '-r600', '-dtiff', '01.tif')
0088 print(h2, '-r600', '-dtiff', '02.tif')
0089 highlight('m01.m', 'rtf', 'm01.rtf')
0090
-
7/25/2019 Projective Geometry and Transformations
16/37
2-17Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
2.2 Two-dimensional Projective Space
Transformation Matrices
0.5000 0 0
0 1.0000 0
0 0 1.0000
0.7071 -0.7071 0
0.7071 0.7071 0
0 0 1.0000
1 0 2
0 1 -3
0 0 1
0.5000 0 0
0 -1.0000 0
0 0 1.0000
2.2.4 Euclidean Transformations - Translation , Rotation and Scaling
-
7/25/2019 Projective Geometry and Transformations
17/37
2-18Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
Introduction
A projectivity is an invertible mapping from points to points that maps
lines to lines
A projectivityHis also calledcollineationorhomography.
2.2 Two-dimensional Projective Space
2.2.5 Projective Transformations - Projectivity
2 3 3 1
2 11 12 13 1
2 21 22 23 1
2 31 32 11
x
x h h h x
y h h h y
w h h w
p H p See Matlab Example!
Invariant Properties
For two points there is one line which is incident with them
Two lines intersect in exactly one incident point. Thus there are noparallel lines. (see later)
There are four points such that no line is incident with more than two
of them.
non-zero elements
-
7/25/2019 Projective Geometry and Transformations
18/37
2-19Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
2.2 Two-dimensional Projective Space
2.2.5 Projective Transformations - Projectivity0001 % Use the following 2-by-11 matrix to draw a simple house
0002
0003 X = [ -6 -6 -7 0 7 6 6 -3 -3 0 0
0004 -7 2 1 8 1 2 -7 -7 -2 -2 -7 ];
0005 no_pts = size(X, 2);
0006 h1 = figure(1); plot(X(1, :), X(2, :), 'ob'), hold on;
0007 title('A Simple House', 'FontWeight', 'bold', 'FontSize', 12);
0008
0009 for i=1:no_pts
0010 x1 = X(:, i);
0011 x2 = X(:, mod(i, no_pts) + 1);
0012 plot([x1(1) x2(1)], [x1(2) x2(2)], '-b')0013 end
0014
0015 % Make Points homogeneous
0016 X = [X; ones(1, size(X, 2))];
0017
0018 % Projectivity 1
0019 H1 = [ 1 0 0;
0020 0 1 0;0021 0.04 0.00 1];
0022
0023 % Projectivity 2
0024 H2 = [ 1 0 0;
0025 0 1 0;
0026 0.04 0.04 1];
0027
0028 disp(H1); disp(H2);
0029
0030 % Apply Transformation
0031 X1 = H1*X;
0032 X2 = H2*X;
0033 disp(X1); disp(X2);0034
0035 % Make Coordinates inhomogeneous
0036 X1 = bsxfun(@rdivide, X1(1:2, :), X1(3, :));
0037 X2 = bsxfun(@rdivide, X2(1:2, :), X2(3, :));0038
0039 X1 = X1(1:2, :);
0040 X2 = X2(1:2, :);
0041
0042 % Plot Transformed Houses
0043 h2 = figure(2);
0044 plot(X1(1, :), X1(2, :), 'or'); hold on;
0045 plot(X2(1, :), X2(2, :), 'og'); hold on;
0046 title('Some Simple Transformations', 'FontWeight', 'bold', 'FontSize
0047 legend('Projectivity 1', 'Projectivity 2');
0048
0049 for i=1:no_pts
0050
0051 x1 = X1(:, i);
0052 x2 = X1(:, mod(i, no_pts) + 1);0053 plot([x1(1) x2(1)], [x1(2) x2(2)], '-r');
0054
0055 x1 = X2(:, i);
0056 x2 = X2(:, mod(i, no_pts) + 1);
0057 plot([x1(1) x2(1)], [x1(2) x2(2)], '-g');
0058 end
0059 axis equal
0060
0061 print(h1, '-r600', '-dtiff', '03.tif')
0062 print(h2, '-r600', '-dtiff', '04.tif')
0063 highlight('m02.m', 'rtf', 'm02.rtf')
0064
-
7/25/2019 Projective Geometry and Transformations
19/37
2-20Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
2.2 Two-dimensional Projective Space
Transformation Matrices
1.0000 0 0
0 1.0000 0
0.0400 0 1.0000
1.0000 0 0
0 1.0000 0
0.0400 0.0400 1.0000
2.2.5 Projective Transformations - Projectivity
-
7/25/2019 Projective Geometry and Transformations
20/37
2-21Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
2.2 Two-dimensional Projective Space
As for image processing homogeneous coordinates are so important
(due to projections of the 3D world to a 2D image), we continue to
talk about representations with these coordinates.
A line in a plane in its general form (normal representation):
wherea,bandcgive rise to different lines.
So a line can be naturally represented by the vector [a b c]T and also
its multiplesk[a b c]T for any non-zerok.
From another point of view: The pointx=[x y]T
in the 2D Euclideanspace belongs to a linel, represented by three valuesa,bandc,so
l= [a b c]T if the condition holds true:
Due to homogeneous coordinates a symmetry is achieved (duality
principle)
xis said to be theright null-spaceoflT.Why?
2.2.6 Lines
Common point of two lines can be found by:
Note that also parallel lines have a common pointapoint at infinity.
It is also possible to find the point by using a skew-symmetric matrix:
0ax by c
T 01
x
a b c y ax by c
l x
T T 0 x l l x
1 1 2
1 2 1 1 2
1 1 2
0
0
0
c b a
c a b
b a c
x l l
( )a cb b
y x m x n
1 2 l x x
2.2
-
7/25/2019 Projective Geometry and Transformations
21/37
2-22Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
Example1
Determine the intersection of the linesl1andl2. Where the first line
corresponds tox=1 and the second toy=1:
Example2
Determine if the pointx1orx2lie on the linel1:
See Matlab Example!
2.2 Two-dimensional Projective Space
2.2.6 Lines
1 2
0 1 0 0 0 0 1 1 0 1 11 0 1 1 0 1 0 1 1 1 1
0 1 0 1 0 0 1 1 0 1 1
x l l
1
1
1 1 1 0 0
1
x x
l
2
0
1 1 1 0 1
1
y y
l
1 2 1
1 0 1
1 , 1 , 0
1 1 1
x x l
!
T
1 1
1
0 1 1 1 0 1 1 1 0 1 1 0
1
x l
!
T
2 1
1
0 0 1 1 0 0 1 1 0 1 1 0
1
x l
-
7/25/2019 Projective Geometry and Transformations
22/37
2-23Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
2.2 Two-dimensional Projective Space
2.2.6 Lines
0001 clear all, close all
0002
0003 [x, y] = meshgrid(-10:1:+10, -10:1:+10);
0004
0005 h1 = figure(1); hold on0006 plot(x, y, 'r.');
0007 X = [
0008 reshape(x, 1, []);
0009 reshape(y, 1, []);0010 ones(1, size(reshape(x, 1, []), 2));
0011 ];
0012
0013 l1 = [-1; 0; 1];
0014 l2 = [ 0; -1; 1];
0015
0016 result1 = l1'*X;
0017 result2 = l2'*X;
00180019 h2 = figure(2), hold on
0020 title('2D Line Evaluation (Line 1)', 'FontWeight', 'bold');
0021 surf(x, y, reshape(result1, size(x)), 'EdgeColor', 'none');0022 xlabel('x'), ylabel('y'), zlabel('result of dot product')
0023 view(45, 45), colorbar
0024 h3 = figure(3), hold on
0025 title('2D Line Evaluation (Line 2)', 'FontWeight', 'bold');
0026 surf(x, y, reshape(result2, size(x)), 'EdgeColor', 'none');
0027 xlabel('x'), ylabel('y'), zlabel('result of dot product')
0028 view(45, 45), colorbar
0029
0030
0031 figure(1);0032 plot(x(reshape(result1, size(x)) == 0), ...
0033 y(reshape(result1, size(y)) == 0), 'g.');
0034 plot(x(reshape(result2, size(x)) == 0), ...
0035 y(reshape(result2, size(y)) == 0), 'g.');
0036 xlabel('x'), ylabel('y')
0037 title('2D Lines', 'FontWeight', 'bold');
0038
0039 print(h1, '-r600', '-dtiff', '01.tif')
0040 print(h2, '-r600', '-dtiff', '02.tif')
0041 print(h3, '-r600', '-dtiff', '03.tif')
-
7/25/2019 Projective Geometry and Transformations
23/37
2-24Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
Consider two pairs of parallel lines:
l1:x1=-1
l2:x2=+1
l3:y3=-1
l4:y4=+1
Letscalculate their intersection:
This is directly comparable to the general understanding of two
parallel lines only meeting at infinity. So the resulting point is anideal
pointorpoint at infinity.
The set of all ideal points may be written as:
Since two points form a line, we can compute theline at infinity l
2.2 Two-dimensional Projective Space
2.2.7 Points and Lines at Infinity
inhomogeneous
1 1 2 1
inhomogeneous
2 1 2 2
1 1 00 / 0
0 0 22 / 0
1 1 0
0 0 22 / 0
1 1 00 / 0
1 1 0
x l l x
x l l x Trying to solve for any ideal point [x1,x2,0]
T reveals a line
with the property:
This line in the is calledline at infinity. In other words this isstating that all ideal points lie on this line.
From this we can deduce following two statements:
Parallel lines meet at an ideal point or the point at infinity.
Different sets of parallel lines intersect in different points at infinity.
To find the line at infinity one needs simply different sets of parallel
lines.
1x
2x
l
inhomogeneous
1 2 1
0 2 00 / 4
2 0 00 / 4
0 0 4
l x x x
T 0x l
1 23 3
0 0
0 0 0 0x x
l l
Tx l l
2
1
2
0
x
x
x
1l 2l3l
4l
2 2 S
-
7/25/2019 Projective Geometry and Transformations
24/37
2-25Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
Under a projective transformation ideal pointsxmay be mapped to
finite pointsxand consequentlylis mapped to a finite linel.
2.2 Two-dimensional Projective Space
2.2.7 Points and Lines at Infinity
x l
3
1 1
2 2
3 00
x
x x
x x
x
x H x
H
1 1 2
1
2 3
3 0, 0
0 0
T
l l
l
l l
l
l l H
H
2 2 T di i l P j ti S
-
7/25/2019 Projective Geometry and Transformations
25/37
2-26Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
2.2 Two-dimensional Projective Space
2.2.7 Points and Lines at Infinity
Metric Properties can be recovered from projectively distorted planes
be mappingfiniteideal points back to infinity
2 2 T di i l P j ti S
-
7/25/2019 Projective Geometry and Transformations
26/37
2-27Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
In a linelis defined uniquely by the join of two pointsxi
In a pointxis defined uniquely by the join of two linesli
2.2.8. Duality of Points and Lines
2.2 Two-dimensional Projective Space
T
1
1 2 T
2
xl x x l 0x
2
T
1
1 2 T
2
lx l l x 0
l
2
zero vector
2 2 T di i l j ti
-
7/25/2019 Projective Geometry and Transformations
27/37
2-30Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
2.2 Two-dimensional projective space
Any homogeneous point in is represented as a 3-vectorxin
Hx is a invertible, linear mappingof homogeneous coordinates,
calledprojectivity.
There are eight independent ratios amongst the nine elements of H,
and it follows that a projective transformation has eight degrees of
freedom(dof).
2.2.9. More on Transformations
2
1 11 12 13 1
2 21 22 23 2
3 31 32 33 3
'
' H '
'
x h h h x
x h h h x
x h h h x
x x
3
image from [2]
1 11 12 13 1
2 21 22 23 2
3 31 32 33 3
'' H '
'
T
T
l h h h l l h h h l
l h h h l
l l
3D Euclidean space
linear transformation in 2D projective space
2 2 T di i l j ti
-
7/25/2019 Projective Geometry and Transformations
28/37
2-32Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
2.2 Two-dimensional projective space
2.2.10. Specialized Transformations in 2D
Rotation
As again indicated by the index E ofH this transformations also
conforms to Euclidean metrics.
It hasonedegree of freedom and can hence be computed from one
point correspondence.
Here againlength,angleandorientationare preserved (invariant).
Translation
A translation is one of the most basic transformation, so they are
conform with the Euclidean interpretation of geometry
Regarding the matrix HE (the index E indicates it is conform toEuclids theorems) a translation hastwo degrees of freedom. Thus
two parameters must be specified in order to define the
transformation.
The transformation can be computed fromone point correspondence
Invariant to this transformation arelength,angleandorientation
1
E 2
1 0
' 0 1 , with
0 0 1
t
t
x H x xE T 1
I tH
0
Iis the 2x2 identity matrix
tis the translation vector
0T
is the null vector
E
cos sin 0
' sin cos 0 , with0 0 1
x H x x
E T
cos sin, and
1 sin cos
R 0H R
0
2 2 T o dimensional projecti e space
-
7/25/2019 Projective Geometry and Transformations
29/37
2-33Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
2.2 Two-dimensional projective space
2.2.10. Specialized Transformations in 2D
Similarity - Translation, Rotation and Scaling
Similarity is an isometry composed with an isotropic scaling
It hasfourdegrees of freedom, accounting one more than Euclidean
for the scaling.
Preserved areangles,parallel linesbut not length whereas the ratio
of lengths is.
Isometries - Translation and Rotation
Also known as Euclidean transformation, rigid body motion or
displacement
The form reminds to the formula of a l ine in Euclideanspace
Preserved arelengthandanglefor sure.
It hasthreedegrees of freedom.
' x Rx t
1
E 2
cos sin
' sin cos , without
0 0 1
t
t
x H x x E T 1
R tH
0
1
S 2
cos sin
' sin cos , with
0 0 1
s s t
s s t
x H x xS T 1
s
R tH
0
srepresent the isotropic scaling
=1 (If it is negative the isometry is not orientation-preserving
and no longer Euclidean Reflection).
2 2 Two dimensional projective space
-
7/25/2019 Projective Geometry and Transformations
30/37
2-34Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
2.2 Two-dimensional projective space
2.2.10. Specialized Transformations in 2D
Projective Transformation
It is a general non-singular linear transformation of homogeneous
coordinates, a so called collineation.
A projective transformation is also known ashomography.
From the nine elements of the matrix only their ratios are significant,
thus the transformation is specified by eight parameters. Concluding
it haseightdegrees of freedom. A projective transformation between two planes can be computed
from four point correspondences, with no three collinear on either
plane.
Invariant is thecross ratio(ratio of ratios)of four collinear points
Affine Transformation
Affine transformation (aka affinity) is a non-singular linear
transformation followed by a translation.
It has six degrees of freedom, corresponding to the six matrixelements (2 translation, 2 rotation, 2 scale (scale ratio and
orientation)).
This transformation can be computed from three point
correspondences.
The new feature added to similarity is the non-isotropic scaling
which is shear-mapping.
Invariant to affinities areparallel lines,ratios of lengthsof parallel line
segments andratio of areas.
Ais a 2x2 non-singular matrix which combines a rotation and a
non-isotropic scaling
11 12 1
A 21 22 2' , with
0 0 1
a a t
a a t
x H x xA T
1
A tH
0
11 12 1
P 21 22 2
1 2
' , with
1
x H x x
a a t
a a t
v v
P T
1
A tH
v
2 2 Two dimensional projective space
-
7/25/2019 Projective Geometry and Transformations
31/37
2-35Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
2.2 Two-dimensional projective space
Conclusion
2.2.10. Specialized Transformations in 2D
2 3 Three dimensional projective space
-
7/25/2019 Projective Geometry and Transformations
32/37
2-36Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
2.3 Three-dimensional projective space
Introduction
Points in the three-dimensional projective space are described by a
4-vector of homogeneous coordinates.
The rule of duality in is slightly different to the one which exist in
the : In the 3Dpoints are dual to planes(instead of lines)
The three-dimensional projective space resides in the four-
dimensional Euclidean space
2.3.1. Points
1
1 4
2
(3 ) (3 ) 2 4
3
3 4
4
/
/
/
D D
XX X
XX X
XX X
X
X X
23
34
2 3 Three dimensional projective space
-
7/25/2019 Projective Geometry and Transformations
33/37
2-37Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
2.3 Three-dimensional projective space
Introduction
A plane can be described in homogeneous coordinates with 3
degrees of freedom.
The first 3 components of correspond to the plane normal ofEuclidean geometry
See Matlab Example!
2.3.2. Planes
1 1 2 2 3 3 4 4 0X X X X
1
2
3
4
T 0 X
0048 % Draw a Plane
0049 figure_2 = figure(2); clf; grid on; hold on;
0050 [X, Y, Z] = meshgrid(-5:0.1:5, -5:0.1:5, -5:0.1:5);
0051
0052 Plane_0 = 0*X + 0*Y + 1*Z - 1;
0053 Plane_1 = 1*X + 1*Y + 1*Z + 0;
00540055 p1 = patch(isosurface(X, Y, Z, Plane_0, 0));
0056 p2 = patch(isosurface(X, Y, Z, Plane_1, 0));
0057
0058 set(p1, 'FaceColor', 'red', 'EdgeColor', 'none')
0059 set(p2, 'FaceColor', 'green', 'EdgeColor', 'none')0060 alpha(0.5); view(45, 45);
0061 xlabel('x'), ylabel('y'), zlabel('z');
0062 title ('Planes in 3D', 'FontWeight', 'bold');
2 3 Three dimensional projective space
-
7/25/2019 Projective Geometry and Transformations
34/37
2-38Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
2.3 Three-dimensional projective space
Duality of Points and Planes
In a plane is defined uniquely by the join of three pointsXi
In a pointXis defined uniquely by the join of three planes i
2.3.2. Planes
Points and Planes at Infinity
In 3 dimensions (analogous to 2 dimensions) there exist the point at
infinityXand the plane at infinity .
Two planes are parallel if their intersection line lies on .
See Matlab Example!
T
1
T
2
T
3
0
X
X
X
3
T
1
T
2
T
3
0
X
3
1
2
3
0
0, with the direction given as
0
1 0
X
X
X
D
2 3 Three-dimensional projective space
-
7/25/2019 Projective Geometry and Transformations
35/37
2-41Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
2.3 Three-dimensional projective space
Introduction
Projective transformations of 3-space are analogous to those of the
planar transformations.
His the arbitrary 4x4 homography matrix.
We have 16 elements which account for15 degrees of freedom
(DOF)and one for the matrix scaling
2.3.3 Transformations in 3D
' x Hx
11 12 13 141 1
21 22 23 242 2
31 32 33 343 3
41 42 43 444 4
'
'
'
'
h h h hx x
h h h hx x
h h h hx x
h h h hx x
2 3 Three-dimensional projective space
-
7/25/2019 Projective Geometry and Transformations
36/37
2-42Professur Digital- und SchaltungstechnikProf. Dr.-Ing. Gangolf Hirtz
Computer Vis ionVersion 08.05.2015
2.3 Three-dimensional projective space
Conclusion
2.3.5 Transformations in 3D
Ais an invertible 3x3 matrix
Ris a 3D rotation matrix, sis a scalar
tis a 3D translation vector t=(t1,t2,t3)T
va general 3-vector, va scalar
0T is the null 3-vector
vTv
tAProjective(15dof)
Affine
(12dof)
Similarity
(7dof)
Euclidean
(6dof)
Intersection and tangency
Parallelism of planes,
Volume ratios,
The plane at infinity
The absolute conic
Volume
10
tAT
10
tR
T
s
10
tRT
Transformation
(degree of freedom)
Shape Invariants propertiesH
Literature
-
7/25/2019 Projective Geometry and Transformations
37/37
P f Di it l d S h lt t h ik C t Vi i
Literature
[1] http://www.cs.unc.edu/~marc/tutorial/node3.html
[2] Richard Hartley, Andrew Zisserman. Multiple View Geometry in computer vision.
Cambridge university press, 2003
[3] Boguslaw Cyganek, J. Paul Siebert. An Introduction to 3D Computer Vision
Techniques and Algorithms. John Wiley & Sons, Ltd, 2009
[4] Richard Szeliski. Computer VisionAlgorithms and Applications. Springer-Verlag
London Limited, 2011
[5] http://www.cs.clemson.edu/~dhouse/courses/405/
top related