Download presentation
Presentation is loading. Please wait.
2
Part 1: The 2D projective plane and it’s applications Martin Jagersand CMPUT 613 Non-Euclidean Geometry for Computer Vision
3
Why geometry? X Y Z HZ X x = x y Scene structure Image structure == x X X Y f Z Richard Hartley and Andrew Zisserman, Multiple View Geometry, Cambridge University Publishers, 2 nd ed. 2004 2D Geometry readings: Ch1: Cursorly Ch 2.1-4, 2.7, Ch 4.1-4.2.5, 4.4.4-4.8 cursorly
4
Modeling from images Camera(s) Scene structure Image Image Structure World model-based rendering image-based modeling image-based rendering Tracking & SFM Camera(s) What 2d and 3d representations best support this process?
5
Euclidean Geometry? Is Euclidean geometry needed?Is Euclidean geometry needed? Rendering: requires only model reprojection Rendering: requires only model reprojection Robotics: control via image feature alignments Robotics: control via image feature alignments
6
Rendering: pixel reprojectionRendering: pixel reprojection Robotics: visual servoingRobotics: visual servoing Euclidean model needed?
7
Euclidean Geometry? Is Euclidean geometry needed?Is Euclidean geometry needed? Rendering: requires model reprojection Rendering: requires model reprojection Robotics: control via image feature alignments Robotics: control via image feature alignments Euclidean model:Euclidean model: + describes the real world of objects/scenes + describes the real world of objects/scenes + quite natural for most people to work with (everyday relationships, angles, distances, …) + quite natural for most people to work with (everyday relationships, angles, distances, …) - difficult to extract from images (camera is not a Euclidean measuring device) - difficult to extract from images (camera is not a Euclidean measuring device) x y X Y f Z = nonlinear… X Y Z
8
What images don’t provide Rendering’s inverse lengths depth
9
What images don’t provide Multiple views… left right
10
What images don’t provide Multiple views… left right above
11
How bad can it get? Radial lens distortion (barrel and pincushion) vs. field of view
12
Correcting Lens Distortion Distortion model Parameter estimation reference features “corrected” image Tsai ’87; Brand, Mohr, Bobet ’94
13
X Y Z Homogeneous coordinates X Y Z s s 0 X∞X∞ X Y 0 X∞X∞ = Perspective imaging models 2d projective space Each 3D ray is a point in P 2 : homogeneous coords. Ideal points P 2 is R 2 plus a “line at infinity” l∞l∞ The 2D projective plane Projective point l∞l∞ x y X Y 1 Z = Inhomogeneous equivalent
14
Lines HZ Ideal line ~ the plane parallel to the image A B C l = X = l T X = X T l = AX + BY + CZ = 0 l∞l∞ = 0 0 1 Projective line ~ a plane through the origin For any 2d projective property, a dual property holds when the role of points and lines are interchanged. Duality: X Y 0 X∞X∞ = l1l1 l2l2 X= X1X1 X2X2 =l The line joining two pointsThe point joining two lines X Y Z X l “line at infinity” AX + BY + C = 0
15
Conics Conic:Conic: –Euclidean geometry: hyperbola, ellipse, parabola & degenerate –Projective geometry: equivalent under projective transform –Defined by 5 points Tangent lineTangent line Dual conic C*Dual conic C* inhomogeneous homogeneous
16
Projective transformations Homographies, collineations, projectivities Homographies, collineations, projectivities 3x3 nonsingular H 3x3 nonsingular H maps P 2 to P 2 8 degrees of freedom determined by 4 corresponding points Transforming Lines? subspaces preserved: pts on line remain on line substitution dual transformation
17
Planar Projective Warping HZ A novel view rendered via four points with known structure
18
Planar Projective Warping HZ OriginalTop-downFacing right Artifacts are apparent where planarity is violated...
19
2d Homographies 2 images of a plane 2 images from the same viewpoint (Perspectivity)
20
Panoramic imaging Appl: Quicktime VR, robot navigation etc. Homographies of the world, unite!
21
Image mosaics HZ
22
GroupTransformationInvariantsDistortion Projective 8 DOF Cross ratioCross ratio IntersectionIntersection TangencyTangency Affine 6 DOF ParallelismParallelism Relative dist in 1dRelative dist in 1d Line at infinityLine at infinity Similarity 4 DOF Relative distances Relative distances Angles Angles Dual conic Dual conic Euclidean 3 DOF Lengths Lengths Areas Areas Geometric strata: 2d C*C* 2 dof l l C*C*
23
The line at infinity HZ 2:17: The line at infinity l is a fixed line under a projective transformation H if and only if H is an affinity Note: But points on l can be rearranged to new points on l
24
Affine properties from images Projection (Imaging) Rectification Post-processing
25
Affine rectification v1v1 v2v2 l1l1 l2l2 l4l4 l3l3 l∞l∞ Point transformation for Aff Rect: Exercise: Verify
26
Math tools 1: Solving Linear Systems If m = n ( A is a square matrix), then we can obtain the solution by simple inversion:If m = n ( A is a square matrix), then we can obtain the solution by simple inversion: If m > n, then the system is over-constrained and A is not invertibleIf m > n, then the system is over-constrained and A is not invertible –Use Matlab “\” to obtain least-squares solution x = A\b to Ax =b internally Matlab uses QR-factorization (cmput340) to solve this. –Can also write this using pseudoinverse A + = (A T A) -1 A T to obtain least-squares solution x = A + b
27
Fitting Lines A 2-D point x = (x, y) is on a line with slope m and intercept b if and only if y = mx + bA 2-D point x = (x, y) is on a line with slope m and intercept b if and only if y = mx + b Equivalently,Equivalently, So the line defined by two points x 1, x 2 is the solution to the following system of equations:So the line defined by two points x 1, x 2 is the solution to the following system of equations:
28
Fitting Lines With more than two points, there is no guarantee that they will all be on the same lineWith more than two points, there is no guarantee that they will all be on the same line Least-squares solution obtained from pseudoinverse is line that is “closest” to all of the pointsLeast-squares solution obtained from pseudoinverse is line that is “closest” to all of the points courtesy of Vanderbilt U.
29
Example: Fitting a Line Suppose we have points (2, 1), (5, 2), (7, 3), and (8, 3)Suppose we have points (2, 1), (5, 2), (7, 3), and (8, 3) ThenThen and x = A + b = (0.3571, 0.2857) T Matlab: x = A\b
30
Example: Fitting a Line
31
Homogeneous Systems of Equations Suppose we want to solve A x = 0Suppose we want to solve A x = 0 There is a trivial solution x = 0, but we don’t want this. For what other values of x is A x close to 0 ?There is a trivial solution x = 0, but we don’t want this. For what other values of x is A x close to 0 ? This is satisfied by computing the singular value decomposition (SVD) A = UDV T (a non-negative diagonal matrix between two orthogonal matrices) and taking x as the last column of VThis is satisfied by computing the singular value decomposition (SVD) A = UDV T (a non-negative diagonal matrix between two orthogonal matrices) and taking x as the last column of V –Note that Matlab returns [U, D, V] = svd(A)
32
Line-Fitting as a Homogeneous System A 2-D homogeneous point x = (x, y, 1) T is on the line l = (a, b, c) T only whenA 2-D homogeneous point x = (x, y, 1) T is on the line l = (a, b, c) T only when ax + by + c = 0 ax + by + c = 0 We can write this equation with a dot product:We can write this equation with a dot product: x l = 0, and hence the following system is implied for multiple points x 1, x 2,..., x n : x l = 0, and hence the following system is implied for multiple points x 1, x 2,..., x n :
33
Example: Homogeneous Line-Fitting Again we have 4 points, but now in homogeneous form:Again we have 4 points, but now in homogeneous form: (2, 1, 1), (5, 2, 1), (7, 3, 1), and (8, 3, 1) (2, 1, 1), (5, 2, 1), (7, 3, 1), and (8, 3, 1) Our system is:Our system is: Taking the SVD of A, we get:Taking the SVD of A, we get: compare to x = (0.3571, 0.2857) T
34
Parameter estimation in geometric transforms 2D homography2D homography Given a set of (x i,x i ’), compute H (x i ’=Hx i ) 3D to 2D camera projection3D to 2D camera projection Given a set of (X i,x i ), compute P (x i =PX i ) Fundamental matrixFundamental matrix Given a set of (x i,x i ’), compute F (x i ’ T Fx i =0) Trifocal tensorTrifocal tensor Given a set of (x i,x i ’,x i ”), compute T Now
35
Estimating Homography H given image points x HZ A novel view rendered via four points with known structure
36
Number of measurements required At least as many independent equations as degrees of freedom requiredAt least as many independent equations as degrees of freedom required Example:Example: 2 independent equations / point 8 degrees of freedom 4x2≥8
37
Approximate solutions Minimal solutionMinimal solution 4 points yield an exact solution for H More pointsMore points –No exact solution, because measurements are inexact (“noise”) –Search for “best” according to some cost function –Algebraic or geometric/statistical cost
38
Many ways to solve: Different Cost functions => differences in solution Algebraic distanceAlgebraic distance Geometric distanceGeometric distance Reprojection errorReprojection error ComparisonComparison Geometric interpretationGeometric interpretation
39
Gold Standard algorithm Cost function that is optimal for some assumptionsCost function that is optimal for some assumptions Computational algorithm that minimizes it is called “Gold Standard” algorithmComputational algorithm that minimizes it is called “Gold Standard” algorithm Other algorithms can then be compared to itOther algorithms can then be compared to it
40
Estimating H : The Direct Linear Transformation (DLT) Algorithm x i =HX i is an equation involving homogeneous vectors, so HX i and x i need only be in the same direction, not strictly equalx i =HX i is an equation involving homogeneous vectors, so HX i and x i need only be in the same direction, not strictly equal We can specify “same directionality” by using a cross product formulation:We can specify “same directionality” by using a cross product formulation:
41
Direct Linear Transformation (DLT)
42
Equations are linear in hEquations are linear in h Only 2 out of 3 are linearly independentOnly 2 out of 3 are linearly independent (indeed, 2 eq/pt) (only drop third row if w i ’≠0) Holds for any homogeneous representation, e.g. ( x i ’, y i ’,1)Holds for any homogeneous representation, e.g. ( x i ’, y i ’,1)
43
Direct Linear Transformation (DLT) Solving for HSolving for H size A is 8x9 or 12x9, but rank 8 Trivial solution is h =0 9 T is not interesting 1-D null-space yields solution of interest pick for example the one with
44
Direct Linear Transformation (DLT) Over-determined solutionOver-determined solution No exact solution because of inexact measurement i.e. “noise” Find approximate solution - Additional constraint needed to avoid 0, e.g. - not possible, so minimize
45
DLT algorithm Objective Given n≥4 2D to 2D point correspondences {x i ↔x i ’}, determine the 2D homography matrix H such that x i ’=Hx i Algorithm (i)For each correspondence x i ↔x i ’ compute A i. Usually only two first rows needed. (ii)Assemble n 2x9 matrices A i into a single 2 n x9 matrix A (iii)Obtain SVD of A. Solution for h is last column of V (iv)Determine H from h (reshape)
46
Inhomogeneous solution Since h can only be computed up to scale, pick h j =1, e.g. h 9 =1, and solve for 8-vector Solve using Gaussian elimination (4 points) or using linear least-squares (more than 4 points) However, if h 9 =0 this approach fails also poor results if h 9 close to zero Therefore, not recommended for general homographies Note h 9 =H 33 =0 if origin is mapped to infinity
47
Normalizing transformations Since DLT is not invariant to coordinate transforms, what is a good choice of coordinates?Since DLT is not invariant to coordinate transforms, what is a good choice of coordinates?e.g. –Translate centroid to origin –Scale to a average distance to the origin –Independently on both images Or
48
Normalized DLT algorithm Objective Given n≥4 2D to 2D point correspondences {x i ↔x i ’}, determine the 2D homography matrix H such that x i ’=Hx i Algorithm (i)Normalize points (ii)Apply DLT algorithm to (iii)Denormalize solution
49
Importance of normalization ~10 2 ~10 4 ~10 2 1 1 orders of magnitude difference!
50
Degenerate configurations x4x4 x1x1 x3x3 x2x2 x4x4 x1x1 x3x3 x2x2 H? H’? x1x1 x3x3 x2x2 x4x4 Constraints: i =1,2,3,4 Define: Then, H * is rank-1 matrix and thus not a homography (case A) (case B) If H * is unique solution, then no homography mapping x i →x i ’(case B) If further solution H exist, then also αH * +βH (case A) (2-D null-space in stead of 1-D null-space)
51
short and long focal length Radial Distortion
54
Correction of distortion Choice of the distortion function and center Computing the parameters of the distortion function (i)Minimize with additional unknowns (ii)Straighten lines (iii)… Radial Distortion
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.