CS 395/495-26: Spring 2003 IBMR: Week 3 A 2D Projective Geometry: Conics Measure Angles Jack Tumblin

Slides:



Advertisements
Similar presentations
Invariants (continued).
Advertisements

1 A camera is modeled as a map from a space pt (X,Y,Z) to a pixel (u,v) by ‘homogeneous coordinates’ have been used to ‘treat’ translations ‘multiplicatively’
Primitives Behaviour at infinity HZ 2.2 Projective DLT alg Invariants
Conics DLT alg HZ 4.1 Rectification HZ 2.7 Hierarchy of maps Invariants HZ 2.4 Projective transform HZ 2.3 Behaviour at infinity Primitives pt/line/conic.
Recovery of affine and metric properties from images in 2D Projective space Ko Dae-Won.
Projective Geometry- 3D
Mapping: Scaling Rotation Translation Warp
Recovering metric and affine properties from images
Recovering metric and affine properties from images
Multiple View Geometry Projective Geometry & Transformations of 2D Vladimir Nedović Intelligent Systems Lab Amsterdam (ISLA) Informatics Institute,
CS 395/495-26: Spring 2003 IBMR: Week 4B Chapter 3: Estimation & Accuracy Jack Tumblin
1 Basic geometric concepts to understand Affine, Euclidean geometries (inhomogeneous coordinates) projective geometry (homogeneous coordinates) plane at.
The 2D Projective Plane Points and Lines.
Invariants. Definitions and Invariants A definition of a class means that given a list of properties: –For all props, all objects have that prop. –No.
Multiple View Geometry Marc Pollefeys University of North Carolina at Chapel Hill Modified by Philippos Mordohai.
Projective 2D & 3D geometry course 2
CS 395/495-26: Spring 2003 IBMR: Week 3 B Finish Conics, & SVD Review Jack Tumblin
CS 395/495-26: Spring 2004 IBMR: 2-D Projective Geometry --Introduction-- Jack Tumblin
CS 395/495-25: Spring 2003 IBMR: Week 6B R 3  R 2 and P 3  P 2 The Camera Matrix Jack Tumblin
Projective geometry- 2D Acknowledgements Marc Pollefeys: for allowing the use of his excellent slides on this topic
Uncalibrated Geometry & Stratification Sastry and Yang
CS 395/495-26: Spring 2004 IBMR: Projective 2D DLT Jack Tumblin
CS 395/495-26: Spring 2004 IBMR: 2-D Conics: Introduction Jack Tumblin
Multiple View Geometry
Projective 2D geometry Appunti basati sulla parte iniziale del testo
Projective 3D geometry. Singular Value Decomposition.
CS 395/495-26: Spring 2003 IBMR: Week 4A from Chapter 3: Point Correspondence and Direct Linear Transform (DLT) Jack Tumblin
Multiple View Geometry Marc Pollefeys University of North Carolina at Chapel Hill Modified by Philippos Mordohai.
CS 395/495-26: Spring 2003 IBMR: Week 1B 2-D Projective Geometry Jack Tumblin
3D photography Marc Pollefeys Fall 2007
Projective Geometry and Camera model Class 2
© 2003 by Davi GeigerComputer Vision October 2003 L1.1 Structure-from-EgoMotion (based on notes from David Jacobs, CS-Maryland) Determining the 3-D structure.
Previously Two view geometry: epipolar geometry Stereo vision: 3D reconstruction epipolar lines Baseline O O’ epipolar plane.
CS 395/495-26: Spring 2003 IBMR: Week 5 A Back to Chapter 2: 3 -D Projective Geometry Jack Tumblin
CS 395/495-26: Spring 2003 IBMR: Week 2 B 2-D Projective Geometry Jack Tumblin
CS 395/495-25: Spring 2003 IBMR: Week 8A Chapter 8... Epipolar Geometry: Two Cameras: Jack Tumblin
Projective 2D geometry course 2 Multiple View Geometry Comp Marc Pollefeys.
One Mark Questions. Choose the Correct Answer 1.If p is true and q is false then which of the following is not true? (a) ~ p is true (b) p  q is true.
Projective 2D geometry course 2 Multiple View Geometry Comp Marc Pollefeys.
Orthogonal Matrices and Spectral Representation In Section 4.3 we saw that n  n matrix A was similar to a diagonal matrix if and only if it had n linearly.
2IV60 Computer Graphics Basic Math for CG
Copyright © Cengage Learning. All rights reserved.
Principal Component Analysis Adapted by Paul Anderson from Tutorial by Doug Raiford.
Admin; Starter Code Website Ready: Plans evolving...Website Ready: Plans evolving... Starter Code Ready: also evolves...Starter Code Ready: also evolves...
Projective Geometry and Geometric Invariance in Computer Vision Babak N. Araabi Electrical and Computer Eng. Dept. University of Tehran Workshop on image.
Robot Vision SS 2008 Matthias Rüther 1 ROBOT VISION Lesson 2: Projective Geometry Matthias Rüther Slides courtesy of Marc Pollefeys Department of Computer.
Homogeneous Coordinates (Projective Space) Let be a point in Euclidean space Change to homogeneous coordinates: Defined up to scale: Can go back to non-homogeneous.
Pole/polar consider projective geometry again we may want to compute the tangents of a curve that pass through a point (e.g., visibility) let C be a conic.
Objects at infinity used in calibration
Projective 3D geometry class 4
Day x: Infinity DLT alg HZ 4.1 Rectification HZ 2.7 Hierarchy of maps Invariants HZ 2.4 Projective transform HZ 2.3 Behaviour at infinity Primitives pt/line/conic.
Multi-linear Systems and Invariant Theory in the Context of Computer Vision and Graphics CS329 Amnon Shashua.
Day x 5-10 minute quiz SVD demo review of metric rectification algorithm 1.build a 2x3 matrix A from orthog line pairs A = [L1M1, L1M2+L2M1, L2M2; L1’M1’,
11.6 Solving Quadratic Systems. Two equations of the form Ax 2 + Bxy + Cy 2 + Dx + Ey + F = 0 considered together is called a quadratic system. You can.
Multi-linear Systems and Invariant Theory
Conic Sections An Introduction. Conic Sections - Introduction Similar images are located on page 604 of your book. You do not need to try and recreate.
Auto-calibration we have just calibrated using a calibration object –another calibration object is the Tsai grid of Figure 7.1 on HZ182, which can be used.
1 Overview Introduction to projective geometry 1 view geometry (calibration, …) 2-view geometry (stereo, motion, …) 3- and N-view geometry Autocalibration.
Digital Image Processing Additional Material : Imaging Geometry 11 September 2006 Digital Image Processing Additional Material : Imaging Geometry 11 September.
Instructor: Mircea Nicolescu Lecture 9
Projective 2D geometry (cont’) course 3 Multiple View Geometry Modified from Marc Pollefeys’s slides.
Projective 2D geometry course 2 Multiple View Geometry Comp Marc Pollefeys.
CS682, Jana Kosecka Rigid Body Motion and Image Formation Jana Kosecka
Calibration ECE 847: Digital Image Processing Stan Birchfield Clemson University.
Homogeneous Coordinates (Projective Space)
CS Visual Recognition Projective Geometry Projective Geometry is a mathematical framework describing image formation by perspective camera. Under.
Conic Sections An Introduction.
IBMR: Week 4B Chapter 3: CS 395/495-26: Spring 2003
The Pinhole Camera Model
Presentation transcript:

CS 395/495-26: Spring 2003 IBMR: Week 3 A 2D Projective Geometry: Conics Measure Angles Jack Tumblin

x’ Apply the 3x3 matrix H x’ = Hx Apply the 3x3 matrix H x’ = Hx Recall: Projective Transform H x3x3x3x3 x2x2x2x2 x1x1x1x1 x y x’ y’ (x,y) x (x’,y’) Homog. coords x’ = [x’,y’,1] T  2D image (x’,y’) 2D image (x,y)  Homog. coords [x,y,1] T = x

x’ Apply the 3x3 matrix H x’ = Hx Apply the 3x3 matrix H x’ = Hx Recall: Projective Transform H x3x3x3x3 x2x2x2x2 x1x1x1x1 x y x’ y’ (x,y) x (x’,y’) Homog. coords x’ = [x’,y’,1] T  2D image (x’,y’) 2D image (x,y)  Homog. coords [x,y,1] T = x Goal: Find H for ‘Image Rectification’ ‘World Plane’ ‘View Plane’

Recall: The bits and pieces of H Recall: The bits and pieces of H H has 8 independent variables (DOF) Computer Vision Jargon (2D projective):Computer Vision Jargon (2D projective): Isometry --3DOF(2D translate t x,t y ; 2D rotate  z ; ) Similarity --4DOF (add uniform scale s;) Affine --6DOF (add orientable scale s ,/s, s  /s) Projective--8DOF (changes x 3 ; 3D-rotation-like) Rectification “up to a Similarity” removeRectification “up to a Similarity” remove

Recall: Rectification Undo parts of H x’ = H xwhere H = H S H A H P GOAL: Put world plane x’ into view plane x –Affine Rect.; (find only H P (2DOF)); –Metric Rect.;(find H A and H P (6DOF)); –Full Rect.;(find all: H S H A H P (8DOF)); METHODS: 1.Affine: ‘Vanishing Point’, Horizon line methods 2.Metric: Conics & Circular Points 3.Full: 4-point correspondence

Intuition for Conics: 2D Ellipses Cartesian Circle/Ellipse: a x 2 + b y 2 – r 2 = 0Cartesian Circle/Ellipse: a x 2 + b y 2 – r 2 = 0 P 2 Circle/Ellipse: a x b x 2 2 – r 2 x 3 2 = 0P 2 Circle/Ellipse: a x b x 2 2 – r 2 x 3 2 = 0 5 parameters (deg. of freedom):5 parameters (deg. of freedom): –center point (cx, cy) –major, minor axes (1/a, 1/b) –orientation  1/a 1/b 

Intuition for Conics: 2D Ellipses Still a circle/ellipse after P 2 projective transform H1H1H1H1 H2H2H2H2 H3H3H3H3

Conics: Key Ideas Conic method: Clever math, but NOT intuitive! (and book gives ugly, scattered description) –P 2 Conics are the family of ALL quadratics of (x 1, x 2, x 3 ) –Includes simpler ‘degenerate’ forms: point, line, line-pair, parabolas, hyperbolae. –Closed: ANY Conic transformed by H == Another Conic (imaginary)

Conics: Key Ideas –Transformed conics tell you how H changes angles –one strange, degenerate conic C*  measures angle –Angles between line pairs yield transformed C*  –We can compute H A and H P from transformed C*  2D world space 2D image space H S H A H P C*  = C*  ’ =    L M m L     

Conic Review Review conics first (pg.8) –‘Conics’ == intersection of cone & plane: –Many possible shapes: circles, ellipses, parabola, hyperbola, degenerate lines & points Dual Forms: –‘Point Conics’ defined by points on the curve –‘Line Conics’ defined by lines tangent to curve

Point Conics: C –All points on any conic solve a 2D quadratic: ax 2 + bxy + cy 2 +dx +ey +f = 0 –In homogeneous coordinates: (mpy. all by x 3 2 ) ax bx 1 x 2 + cx 2 2 +dx 1 x 3 +ex 2 x 3 + fx 3 2 = 0 ax bx 1 x 2 + cx 2 2 +dx 1 x 3 +ex 2 x 3 + fx 3 2 = 0 x T Cx = 0 x T Cx = 0 –C is symmetric, 5DOF ( not 6; ignores x 3 scaling) –Can find any C from 5 homog. point pairs... (SVD solves for null space—see book pg 9) a b/2 d/2 a b/2 d/2 b/2 c e/2 d/2 e/2 f x1x1x2x2x3x3x1x1x2x2x3x3 = 0 x 1 x 2 x 3 (but not very useful for finding H...)

Familiar Conics: Circles, Ellipses... x T C x = 0 or General form of point conic:General form of point conic: ax 2 + bxy + cy 2 +dx +ey +f = 0 (or) ax bx 1 x 2 + cx 2 2 +dx 1 x 3 +ex 2 x 3 + fx 3 2 = 0 Circle at d with radius r:Circle at d with radius r: 1x bx 1 x 2 + 1x 2 2 +dx 1 x 3 +ex 2 x 3 –r 2 x 3 2 = 0; C r = ‘Degenerate’ Cases (rank<3): lines, parabolas, hyperbolae... Example:‘Degenerate’ Cases (rank<3): lines, parabolas, hyperbolae... Example: 1x bx 1 x 2 + 0x 2 2 +dx 1 +ex 2 + fx 3 2 = 0; a b/2 d/2 a b/2 d/2 b/2 c e/2 d/2 e/2 f x1x1x2x2x3x3x1x1x2x2x3x3 = 0 x 1 x 2 x r 2 a f

Matrix C makes conic curves from points x : x T Cx = 0C is a ‘point conic’Matrix C makes conic curves from points x : x T Cx = 0C is a ‘point conic’ The tangent line L for point x is: L = C xThe tangent line L for point x is: L = C x P2 conic transformed by H:P2 conic transformed by H: C’ = H -T C H -1 (messy! requires invertible H !) Point Conics: C L x

Matrix C* makes conic curves from lines L : L T C* L = 0C is a ‘line conic’Matrix C* makes conic curves from lines L : L T C* L = 0C is a ‘line conic’ The tangent point x for line L is: x = C* LThe tangent point x for line L is: x = C* L Projective transform by H is:Projective transform by H is: C*’ = H C* H T (better -- no H inversion required) If C is non-singular (rank 3), then C* = C -1If C is non-singular (rank 3), then C* = C -1 ‘Dual’ or Line Conics: C L x

Degenerate Conics x T C x = 0 or General form of point conic:General form of point conic: ax 2 + bxy + cy 2 +dx +ey +f = 0 (or) ax bx 1 x 2 + cx 2 2 +dx 1 x 3 +ex 2 x 3 + fx 3 2 = 0 Very special ‘degenerate’ case: ‘infinite radius circle’ as x 3  0, aka C  Very special ‘degenerate’ case: ‘infinite radius circle’ as x 3  0, aka C  1x bx 1 x 2 + 1x 2 2 +dx 1 x 3 +ex 2 x 3 +0x 3 2 = 0 C  = only solutions to x T C  x =0 are 2 complex x vectors: and a b/2 d/2 a b/2 d/2 b/2 c e/2 d/2 e/2 f x1x1x2x2x3x3x1x1x2x2x3x3 = 0 x 1 x 2 x i 0 1 -i -i 0

Conic Weirdness I ‘Circular Points’ I=, J= ; or C  = –‘Ideal points’; 2 points at infinity / horizon, but… –Complex : real part on x axis, imag. on y –“Where infinite circle hits infinity line L  [0,0,1]” –Where? imaginary! (infinite x,y axes, maybe?) –I,J are not affected by H S. ( only by H A, H P ) ?WHY BOTHER? –To measure angles in projective space –To use angle correspondences to find H A,H P 1 i 0 1 -i -i

Conic Weirdness 2 ‘Circular Points’ I=, J= ; and C  = C  is a point conic, affected by H A H P only.C  is a point conic, affected by H A H P only. C*  is line conic, but the same matrix (!?!?!)C*  is line conic, but the same matrix (!?!?!) –Is same as this outer product: IJ T + JI T –Includes L , the infinity line (L  C*  L  =0) –Affected by H P and H A only, ( H S does nothing) ALL transforms of C*  have only 4DOF (pg 33 ) 1 i 0 1 -i -i

Conics: Angle Measuring Matrix H transforms C*  to another space:Matrix H transforms C*  to another space: C*  ’ = H C*  H T Angles: –define ‘world space’ C*  as –(for any two world-space homogeneous lines) L and m are perpendicular iff L T C*  m = 0 –Also true for transformed L, m and C* , so… –C*  ’ in image space  angle in world space –C*  ’ in image space  angle  in world space (L T C*  ’ m) (L T C*  ’ L)(m T C*  ’ m) cos(  ) = (simpler to transform a line conic)

Undoing H: Metric Rectification C*  ’ has only 4DOF (before,after ANY H)C*  ’ has only 4DOF (before,after ANY H) All C*  ’ DOF are contained in (H A H P )All C*  ’ DOF are contained in (H A H P ) SVD can convert C*  ’ to (H A H P ) matrix!SVD can convert C*  ’ to (H A H P ) matrix! Task is then “find C*  ’, then use it to find H”Task is then “find C*  ’, then use it to find H” 2D world space 2D image space H S H A H P C*  = C*  ’ =    L M m L   

? But how do we find C*  ’ ? One Answer: use perpendicular lines –(Recall) we defined ‘world space’ C*  as –Then: 2 world-space lines L and m are perpendicular iff L T C*  m = 0 –Also true for transformed L, m and C*  –H transforms C*  to image space C*  ’ by: C*  ’ = H C*  H T –Now split up H and try it: H = H S H A H P, so…

Undoing H: Metric Rect. 1 H = H S H A H P =H = H S H A H P = Book shows how to write transformed C*  as (simple, tedious):Book shows how to write transformed C*  as (simple, tedious): C*  ’ = C*  ’ = where K is 2x2 symmetric (affine part: 2DOF) v is 2x1 vector, (projective part: 2DOF) v is 2x1 vector, (projective part: 2DOF) sRtsRt0T10T1sRtsRt0T10T1 I0I0vTvvTvI0I0vTvvTv K0K00T10T1K0K00T10T1              KK T  Kv       v T K  0

Undoing H: Metric Rect. 1 H = H S H A H P =H = H S H A H P = Book shows how to write transformed C*  as (simple, tedious):Book shows how to write transformed C*  as (simple, tedious): C*  ’ = C*  ’ = where K is 2x2 symmetric (affine part: 2DOF) v is 2x1 vector, (projective part: 2DOF) v is 2x1 vector, (projective part: 2DOF) sRtsRt0T10T1sRtsRt0T10T1 I0I0vTvvTvI0I0vTvvTv K0K00T10T1K0K00T10T1              KK T  Kv       v T K  0 !!!BUT DERIVATION & RESULT IS WRONG!!! SKIP ‘Metric Rectification I’ pg 35,36!

END

Undoing H: Metric Rect. 1 C*  ’ =  C*  ’ =  First, ignore projective part: set v=0.First, ignore projective part: set v=0. Choose two pairs of perpendicular lines L,mChoose two pairs of perpendicular lines L,m Second, Use L T ’ C*  ’ m’ = 0 to solve for KSecond, Use L T ’ C*  ’ m’ = 0 to solve for K KK T  Kv       v T K  s 2D world space 2D image space H S H A H P L M m L KK T  0       0  s 0  s aka ‘Weak Perspective’

Matrix Math & SVDs Matrix multiply is a change of coordinatesMatrix multiply is a change of coordinates –Rows of A = coordinate axis vectors –Ax = a dot product for each axis input space  output space input space  output space SVD ‘factors’ matrix A into 3 parts:SVD ‘factors’ matrix A into 3 parts: –U = orthonormal basis svd(A) = U S V T

Matrix Math & SVDs Matrix multiply is a change of coordinatesMatrix multiply is a change of coordinates –Rows of A = coordinate axis vectors –Ax = a dot product for each axis input space  output space input space  output space SVD ‘factors’ matrix A into 3 parts:SVD ‘factors’ matrix A into 3 parts: –U = orthonormal basis svd(A) = U S V

Recall: Projective Transform: Hx = x’ x1x1x2x2x3x3x1x1x2x2x3x3 h 11 h 12 h 13 h 21 h 22 h 21 h 31 h 32 h 33 = x’ 1 x’ 2 x’ 3 Finding H from point pairs (correspondences) x’ = = y’ = = = xy1 Input (or output) image is on central plane x1x1x2x2x3x3x1x1x2x2x3x3 h 21 x + h 22 y + h 21 h 31 x + h 32 y + h 33 x’ 1 x’ 3 x’ 2 x’ 3 Write R 2 expressions; (for each x,x’ pair) h 11 x + h 12 y + h 13 h 31 x + h 32 y + h 33 x’ (h 31 x + h 32 y + h 33 ) = (h 11 x + h 12 y + h 13 ) y’ (h 31 x + h 32 y + h 33 ) = (h 11 x + h 12 y + h 13 ) Rearrange, solve as a matrix problem…

DLT: Four-Point Correspondence 4 point correspondence:4 point correspondence: –Book shows: –Rearrange: known vector (dot) unknown vector –stack, solve for null space… Hint FilesHint Files –Added ‘max’ commands, examples –Make, test your own H matrices! x’ (h 31 x + h 32 y + h 33 ) = (h 11 x + h 12 y + h 13 ) y’ (h 31 x + h 32 y + h 33 ) = (h 11 x + h 12 y + h 13 ) h 11 h 12 h 13 h 21 h 22 h 23 h 31 h 32 h 33 [x y x’x -x’y -x’] = 0 [0 0 0 x y 1 -y’x -y’y -y’]

Direct Linear Tranform (DLT) Project 2 method: Solve Hx – x’ = 0Project 2 method: Solve Hx – x’ = 0 –Requires constant scale (x 3 =1 in measurement) compare:compare: DLT method: Solve Hx  x’ = 0DLT method: Solve Hx  x’ = 0 –Accepts any scale (x 3 =w  1 OK, xx 3 ) [ x y 1 -y’x -y’y -y’ ] [ x y x’x -x’y -x’ ] h 11 h 12 h 13 h 21 h 22 h 23 h 31 h 32 h 33 [ w’x -w’y -w’w y’x y’y y’w] = 0 [w’x w’y w’w x’x -x’y -x’w]

Direct Linear Tranform (DLT) Project 2 method: Solve Hx – x’ = 0Project 2 method: Solve Hx – x’ = 0 –Requires constant scale (x 3 =1 always) compare:compare: DLT method: Solve Hx  x’ = 0DLT method: Solve Hx  x’ = 0 –Accepts any scale (x 3 =w  1, x 3 ’=w’  1) [ x y 1 -y’x -y’y -y’ ] [ x y x’x -x’y -x’ ] h1 h1 h2 h2 h3 h3 h1 h1 h2 h2 h3 h3 [ w’x -w’y -w’w y’x y’y y’w] = 0 [w’x w’y w’w x’x -x’y -x’w] [ 0 T -w’ i x i T y’ I x i T ] [ w’ i x i T 0 T -x’ i x i T ]

Direct Linear Tranform (DLT) DLT method: Solve H  x = 0DLT method: Solve H  x = 0 –Accepts any scale, any point (x 3 =w  1 is OK) –‘Pure’, Compatible -- P 2 terms only –Much better suited to error measurements. Subtlety:Subtlety: –Won’t divide-by-zero if w=0 or h 33 =0 (it happens!) –has a 3 rd row; it is not degenerate if w’=0 –OK to use it… (Solve 8x12) h1 h1 h2 h2 h3 h3 h1 h1 h2 h2 h3 h3 0 T -w’ i x i T y’ I x i T 0 T -w’ i x i T y’ I x i T w’ i x i T 0 T -x’ i x i T =0 w’ i x i T 0 T -x’ i x i T =0 -y’ i x i T -x’ i x i T 0 T -y’ i x i T -x’ i x i T 0 T

Deceptive ‘Robustness’ Suppose we have 4 pt-correspondences:Suppose we have 4 pt-correspondences: –Use DLT to write 8x9 (or 12x9) matrix A: Ah=0 –Solve for h null space. ALWAYS gives H matrix But what if points are bad / fictional?But what if points are bad / fictional? –3 collinear input pts, crooked out: IMPOSSIBLE! –Yet we get an H solution! Why? A matrix rank is 7 or 6  rank 1 H result(s)A matrix rank is 7 or 6  rank 1 H result(s) –‘Null Space’ of A may contain >1 H solution! –‘Degenerate’ H solution of form aH 1 + bH 2 … Answer: SVD ranks A; reject bad point sets.Answer: SVD ranks A; reject bad point sets.

Actual ‘Robustness’ Vectorizing (‘Flatten, Stack, Null Space’ method) works for almost ANY input! (Points, lines, planes, ||, , conics, quadrics, cross-ratios, vanishing points, twisted cubics…Vectorizing (‘Flatten, Stack, Null Space’ method) works for almost ANY input! (Points, lines, planes, ||, , conics, quadrics, cross-ratios, vanishing points, twisted cubics… Use DLT formulation: (Hx  x’) = 0Use DLT formulation: (Hx  x’) = 0 Rearrange as dot product: (known)·(unknown) = 0Rearrange as dot product: (known)·(unknown) = 0 Be careful to have ENOUGH constraintsBe careful to have ENOUGH constraints tricky when you mix types: points, lines,… (pg 75) tricky when you mix types: points, lines,… (pg 75) measured input transformed  measured output measured output = 0