1 / 43

CS 395/495-26: Spring 2004

CS 395/495-26: Spring 2004. IBMR: 2-D Conics: Introduction Jack Tumblin jet@cs.northwestern.edu. Intuition for Conics: 2D Ellipses. Still a circle/ellipse after P 2 projective transform (Better!) every transformed conic is another conic!. H 1. H 2. H 3.

dermot
Download Presentation

CS 395/495-26: Spring 2004

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 395/495-26: Spring 2004 IBMR: 2-D Conics: Introduction Jack Tumblin jet@cs.northwestern.edu

  2. Intuition for Conics: 2D Ellipses Still a circle/ellipse after P2 projective transform (Better!) every transformed conic is another conic! H1 H2 H3

  3. Intuition for Conics: 2D Ellipses 1/b 1/a • Cartesian axis Circle/Ellipse: a x2+b y2– r2= 0 • P2 axis Circle/Ellipse: a x12 + b x22 – r2 x32 = 0 • 5 parameters (deg. of freedom): • center point (cx, cy) • major, minor axes (1/a, 1/b) • orientation  

  4. Conics: Key Ideas • ‘Conics’== intersection of cone & plane: • Many possible shapes: circles, ellipses, parabola, hyperbola, degenerate lines & points In P2, Conics have Dual Forms: • ‘Point Conics’ defined by points on the curve • ‘Line Conics’ defined by lines tangent to curve

  5. Conics written as a Matrix • All points on any conic solve a 2D quadratic: ax2 + bxy + cy2 +dx +ey +f = 0 • In homogeneous coordinates: (mpy. all by x32) ax12 + bx1x2 + cx22 +dx1x3 +ex2x3 + fx32 = 0 xTCx = 0 • C is symmetric, 5DOF (not 6; ignores x3 scaling) • Can find any C from 5 homog. points... How?(SVD solves Null-space problems easily…) x1 x2 x3 a b/2 d/2 b/2 c e/2 d/2 e/2 f x1 x2 x3 = 0 (and how could conics help you find H?...)

  6. Familiar Conics: Circles, Ellipses... x1 x2 x3 a b/2 d/2 b/2 c e/2 d/2 e/2 f xT C x = 0 or • General form of point conic: ax2 + bxy + cy2 +dx +ey +f = 0 (or) ax12 + bx1x2 + cx22 +dx1x3 +ex2x3 + fx32 = 0 • Circle at d with radius r: 1x12 + bx1x2 + 1x22 +dx1x3 +ex2x3–r2x32 = 0; Cr = • ‘Degenerate’ Cases (C rank<3): lines, parabolas, hyperbolae... Example: ax12 + bx1x2 + 0x22 +dx1 +ex2+ fx32 = 0; x1 x2 x3 = 0 1 0 0 0 1 0 0 0 -r2 a 0 0 0 0 0 0 0 f (Try it—plot points for x3 = 1…)

  7. Point Conics: C • Matrix C makes conic curves from points x: xTCx = 0 C is a ‘point conic’ • The tangent line L for point x is: L = C x • P2 point conic transformed by H: C’ = H-T C H-1 (messy! requires an invertible H !) x L Prove it! Use the two equations above…

  8. ‘Dual’ or Line Conics: C • Matrix C* makes conic curves from lines L: LT C* L = 0 C is a ‘line conic’ • The tangent point x for line L is: x = C* L • Projective transform by H is: C*’ = H C* HT (better -- no H inversion required) • If C is non-singular (rank 3), then C* = C-1 x L Prove it! Use two equations above…

  9. Conic Summary • Matrix C identifies all the points on a conic: xTCx = 0 C is a ‘point conic’ • Given a point x on a conic curve, the homog. tangent line l is given by l = C x • Matrix C* identifies all lines tangent to a conic: lTC*l = 0C* is a ‘Dual Conic’ • Can you prove this? Try it! C* = C-1 (hint: use the boxed equations)

  10. Degenerate Conics 1 i 0 1 -i 0 1 0 0 0 1 0 0 0 0 x1 x2 x3 a b/2 d/2 b/2 c e/2 d/2 e/2 f xT C x = 0 or • General form of point conic: ax2 + bxy + cy2 +dx +ey +f = 0 (or) ax12 + bx1x2 + cx22 +dx1x3 +ex2x3 + fx32 = 0 • Very special ‘degenerate’ case: ‘infinite radius circle’ as x30, aka C 1x12 + bx1x2 + 1x22 +dx1x3 +ex2x3 +0x32 = 0 C = only solutions to xT Cx =0 are 2complexx vectors: and x1 x2 x3 = 0

  11. Conics: Key Ideas 1 0 0 0 1 0 0 0 0 L m • Transformed conics tell you how H will change angles: • one strange, degenerate conic C* can measure angle • Angles between line pairs yield transformed C*    C*= C*’=      0 L’ m’ H = HS HA HP 2D image space 2D world space

  12. Conic Weirdness I 1 i 0 1 -i 0 1 0 0 0 1 0 0 0 0 ‘Circular Points’ I= , J= ; and C = • ‘Ideal points’; 2 points at infinity / horizon, but… • Complex : real part on x1 axis, imag. on x2 • “Where infinite circle hits horizon line L [0,0,1]” • Where? imaginary! (infinite x,y axes, maybe?) ?WHY BOTHER? • To measure angles in projective space • To use angle correspondences to find HA,HP

  13. Conic Weirdness 2 1 i 0 1 -i 0 1 0 0 0 1 0 0 0 0 ‘Circular Points’ I= , J= ; and C = • C is a point conic, affected byHAHP only. • C* is line conic, but is the samematrix(!?!) • Is same as this outer product: IJT + JIT • Intersects L, the infinity line(proof: LC*L=0) • Affected byHP andHA only, ( HSdoes nothing) ALL transforms of C* have only 4DOF (pg 33 )

  14. Conics: Angle Measuring 1 0 0 0 1 0 0 0 0 • Matrix H transforms C* to another space: C*’=H C* HT Angles: • define ‘world space’ C* as • (for any two world-space homogeneous lines) L and m are perpendicular iff LT C* m = 0 • Angle  between lines L and m given by (Remember, it is simpler to transform a line conic) (LTC* m) (LT C* L)(mT C* m) cos() =

  15. Conics: Angle Measuring • Matrix H transforms C* to another space: C*’=H C* HT Angles: • ALSO true for transformedL, m and C*, so… • If you FIND C*’in image space, you can measure 2 image-space lines L’, m’ and find the angle  between them in world space! Use the same expression: (Remember, it is simpler to transform a line conic) (L’T C*’ m’) (L’T C*’ L’) (mT C*’ m’) cos() =

  16. ? How can we find C*’ without H ? One Answer: measure perpendicular lines… • We know 2 world-space lines L and m are perpendicular iff LT C* m = 0 • Also true for transformedL, m and C*: (e.g. in image space)L’T C*’ m’ = 0 Hmmm. L’ and m’ are known, C*’ unknown. Isn’t this a null-space problem? Once we have C*’ then what? See any other uses for conics in P2? 1 0 0 0 1 0 0 0 0

  17. Polar Lines and Pole Points • Line Conic C’s tangent line Lt at point xt by: C xt = Lt(given xt is on the conic:xtT C xt=0) (You can skip this) xt C Lt

  18. Polar Lines and Pole Points • Line Conic C’s tangent line Lt at point xt by: C xt = Lt(given xt is on the conic:xtT C xt=0) • But if x is NOT on the conic? try Cxp = Lp (You can skip this) xp Lp C

  19. Polar Lines and Pole Points • Line Conic C’s tangent line Lt at point xt by: C xt = Lt(given xt is on the conic:xtT C xt=0) • But if x is NOT on the conic? try Cxp = Lp • ‘Polar line’ Lp = conic at p1, p2(find them?ugly!) (You can skip this) p1 xp Lp C p2

  20. Polar Lines and Pole Points • Line Conic C’s tangent line Lt at point xt by: C xt = Lt(given xt is on the conic:xtT C xt=0) • But if x is NOT on the conic? try Cxp = Lp • ‘Polar line’ Lp = conic at p1, p2(to find them?ugly!) • p1, p2 tangent lines meet at ‘Pole point’ xp (You can skip this) p1 xp Lp C p2

  21. Polar Lines and Pole Points • Line Conic C’s tangent line Lt at point xt by: C xt = Lt(given xt is on the conic:xtT C xt=0) • But if x is NOT on the conic? try Cxp = Lp • ‘Polar line’ Lp = conic at p1, p2(to find them?ugly!) • p1, p2 tangent lines meet at ‘Pole point’ xp p1 Interesting, But why does book show it? xp Lp C p2

  22. Question: Can you apply DLT? • Choose pairs of lines that are known to be perpendicular in world space; measure those lines in image space. • Solve for C*’ using L’TC*’ m’ = 0 • We also know that HC*HT=C*’ Can you solve for H?Zisserman tried, but book method is confused, contains errors, and may be incorrect…

  23. END. STOP HERE

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

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

  26. Recall: Rectification Undo parts of H x’ = H x where H = HS HA HP GOAL: Put world plane x’ into view plane x • Affine Rect.; (find only HP(2DOF)); • Metric Rect.; (find HA and HP (6DOF)); • Full Rect.; (find all: HSHAHP (8DOF)); METHODS: • Affine: ‘Vanishing Point’, Horizon line methods • Metric: Conics & Circular Points • Full: 4-point correspondence

  27. Recall: The bits and pieces of H H has 8 independent variables (DOF) • Computer Vision Jargon (2D projective): Isometry --3DOF(2D translate tx,ty; 2D rotate z; ) Similarity --4DOF (add uniform scale s;) Affine --6DOF (add orientable scale s,/s, s/s) Projective--8DOF (changes x3; 3D-rotation-like) Rectification “up to a Similarity” (finds HP, HA)

  28. Conics: Key Ideas 1 0 0 0 1 0 0 0 0 L M • 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 HA and HP from transformed C*    C*= C*’=       L m HS HA HP 2D image space 2D world space

  29. Undoing H: Metric Rect. 1 L M • C*’ =  • First, ignore projective part: set v=0. • Choose two pairs of perpendicular lines L,m • Second, Use LT’ C*’ m’ = 0 to solve for K KKT  Kv    vTK  s KKT 0    0  s aka ‘Weak Perspective’ L m HS HA HP 2D image space 2D world space

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

  31. Undoing H: Metric Rect. 1 • H = HS HA HP = • Book shows how to write transformed C* as (simple, tedious): C*’ = where K is 2x2 symmetric (affine part: 2DOF) v is 2x1 vector, (projective part: 2DOF)    sR t 0T 1 K 0 0T 1 I 0 vT v            KKT  Kv    vTK  0

  32. Undoing H: Metric Rect. 1 • H = HS HA HP = • Book shows how to write transformed C* as (simple, tedious): C*’ = where K is 2x2 symmetric (affine part: 2DOF) v is 2x1 vector, (projective part: 2DOF)    sR t 0T 1 K 0 0T 1 I 0 vT v            !!!BUT DERIVATION & RESULT IS WRONG!!! SKIP ‘Metric Rectification I’ pg 35,36! KKT  Kv    vTK  0

  33. ‘Let SVDs Explain it All for You’ 1 0 0 0 1 0 0 0 0 SVD finds H for you (?) (pg 35) Book’s Method for finding HAHP from C*’ : • C*’= H C* HT is symmetric; • Assume SVD(C*’) = USVT = (U S ) I ( S VT ) = ( H ) C* ( HT) • BUT THIS DOESN’T WORK! • ( Recall C* = ) A = USVT ‘Find Input & Output Axes, Linked by Scale’

  34. Eigen -values,-vectors, Fixed pt & line • Formalizes ‘invariant’ notion: • if x is ‘fixed’ for H, then Hx only scales xH x = x( is a constant scale factor) • x is an ‘eigenvector’,  is its ‘eigenvalue’ • again, SVD helps you find them. • Elaborate topic (but not hard). Skip for now. (You can skip this)

  35. Book Errata Website: http://www.robots.ox.ac.uk/~az/HZbook/HZerrata.html pg. 35, eqn. 1.22 is dubious / erroneous; C*’ = HC*HT = (HSHAHP) C* (HSHAHP)T is the transformed line conic, but book uses C*’ = (HPHAHS) C* (HPHAHS)T instead, AND has error: = But I get: C*’ = KKT  Kv    vTK  ? (book: ?=0; errata website: ?=vTKKTv) KKT  KKTv    vTKKT  vTKKTv

  36. Dubious Book Aggravations: KKT  Kv    vTK  0* • Similarity transform HS leaves C* unchanged:C* =HS C* HST • H transforms C* to image space C*’ by:C*’=H C* HT = (HS HA HP) C* (HS HA HP)T • Book claims to derive C*’ = (HP HA) C* (HP HA)T (!?!?!) Then errs in simplifying to: 1 0 0 0 1 0 0 0 0

  37. SVDs and Conics • Conics (both C and C*) are symmetric; • SVD of any symmetric A is also symmetric:SVD(A) = USUT !Not Always! • Find conics’ singular values’ sign: si =0,1, or –1, to classify conic type: (pg 40) Si values | Equation | Type . imaginary-only circle/ellipse single real point (0,0,1)2 lines: x+/- y2 co-located lines: x=0 x2 + y2 + w2 = 0x2 + y2 - w2 = 0 x2 + y2 = 0x2 - y2 = 0x2 = 0 (1, 1, 1) (1, 1,-1) (1, 1, 0) (1,-1, 0) (1, 0, 0)

  38. Undoing H: Metric Rectification • (recall)H = HS HA HP = • Tedious algebra*(pg35) shows symmetry: C*’ =H C* HT = where K is 2x2 symmetric (affine part: 2DOF) v is 2x1 vector, (projective part: 2DOF) • ?But what do K and V really control? sR  t    0T 1 K  0    0T 1 I 0  vT v KKT  Kv    vTK  0* *==error?!?

  39. Undoing H: Metric Rectification • (recall)H = HS HA HP = • Tedious algebra (pg35) shows symmetry: C*’ =H C* HT = where K is 2x2 symmetric (affine part: 2DOF) v is 2x1 vector, (projective part: 2DOF) • ?But what do K and V really control? sR  t    0T 1 K  0    0T 1 I 0  vT v KKT  Kv    vTK  ? (book: ?=0; errata website: ?=vTKKTv)

  40. Undoing H: Metric Rectification • OK, then how do we find K and v? • (book: ?=0; errata website: ?=vTKKTv) • Choose known-perpendicular line pairs(Li, mi),then compute by: • Method 1a: (pg 36) Assume v=0, solve for K • Method 1b: (NOT in book)Assume K=I, solve for v • Method 2: Rearrange, solve for full C*’ then get HAHP using SVD. KKT Kv    vTK  ? C*’ =H C* HT =

  41. Undoing H: Metric Rect. 1a m1 m2 m3 s1 s2 s3 l1 l2 l3 Method 1a: (pg 36) Assume v=0, solve for K • Choose 2  line pairs (La,ma) and (Lb,mb) • Both pairs satisfy LT C*’ m = 0 or: • (note x3 term is ignored!) • ‘flatten’ to one equation: KKT  0    0  0 KKT  Kv    vTK  0 C*’ =H C* HT =  s1 s2 0 s2 s3 0 0 00 =0 l1m1 l2m1+l1m2 l2m2 = 0

  42. Undoing H: Metric Rect. 1a s1 s2 s3 Method 1a: (pg 36) Assume v=0, solve for K • ‘Stack’ to combine both line pairs; • Solve for s by SVD: find ‘input null space’ (Ax=0) • From s make C*’ = KKT, then extract HAHPusing SVD: recall C*’ =H C* HT , it is symmetric… KKT  Kv    vTK  0 s1 s2 0 s2 s3 0 0 00 C*’ =H C* HT =  la1ma1 la2ma1+la1ma2 la2ma2 = 0 lb1mb1 lb2mb1+lb1mb2 lb2mb2

  43. Undoing H: Metric Rect. 1b m1 m2 m3 l1 l2 l3 Method 1b: (not in book) Assume K=I, solve for v • Choose 2  line pairs (La,ma) and (Lb,mb) • These satisfy LT C*’ m = 0 or: • ‘flatten’ to one equation (messy), stack, solve for v1,v2 • Extract Hp from C*’ using SVD I  v    vT  0 KKT  Kv    vTK  0 C*’ =H C* HT =  1 0 v1 0 1 v2 v1 v2? =0

More Related