Download presentation
Presentation is loading. Please wait.
1
CS 395/495-26: Spring 2003 IBMR: Week 3 B Finish Conics, & SVD Review Jack Tumblin jet@cs.northwestern.edu
2
“Circular Points’: No solutions to x T C* x =0 except 2 complex x vectors: and 1 i 0 1 -i -i 0 Recall: 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 1 2 + bx 1 x 2 + cx 2 2 +dx 1 x 3 +ex 2 x 3 + fx 3 2 = 0 Very special ‘degenerate’ conic C = C* gives angle between transformed lines L’,m’ : Very special ‘degenerate’ conic C = C* gives angle between transformed lines L’,m’ : 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 1 0 0 0 1 0 0 0 0 (L T C* ’ m) (L T C* ’ L’)(m T C* ’ m) cos( ) = C* = C* =
3
Undoing H: Metric Rectification Transformed C* C* ’ has only 4DOFTransformed C* C* ’ has only 4DOF We can convert C* ’ to (H A H P ) matrix!We can convert C* ’ to (H A H P ) matrix! Task is: ‘find C* ’, then find H A H P from it…Task is: ‘find C* ’, then find H A H P from it… 2D world space 2D image space H S H A H P C* = C* ’ = 1 0 0 0 1 0 0 0 0 L M m L 0
4
Compare H A and H P (recall) H = H S H A H P = 2D world space 2D image space HAHAHAHA L M m HPHPHPHP m L L (parallelogram) (quadrilateral) (square) (K matrix, 2DOF) ( v vector) K 0 0 T 1 s R t 0 T 1 I 0 v T v
5
? But how do we find C* ’ ? One Answer: use perpendicular lines –(Recall) we defined ‘world space’ C* as –We know 2 world-space lines L and m are perpendicular iff L T C* m = 0 –Also true for transformed L, m and C* : perpendicular iff L’ T C* ’ m’ = 0 perpendicular iff L’ T C* ’ m’ = 0 1 0 0 0 1 0 0 0 0
6
? But how do we find C* ’ ? H = H S H A H P =H = H S H A H P = Book shows how to write transformed C* as:Book shows how to write transformed C* as: 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
7
? But how do we find C* ’ ? 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!
8
Method 2: Rearrange, ‘flatten’ C* ’ constraint: Choose 5 line pairs (L 1,M 1 ) … (L 5,M 5 )Choose 5 line pairs (L 1,M 1 ) … (L 5,M 5 ) For each one, L T C* ’ M = 0 or:For each one, L T C* ’ M = 0 or: ‘flatten’ to one equation:‘flatten’ to one equation: Undo H: Metric Rectification 2 C* ’ = H C* H T = m1m1m2m2m3m3m1m1m2m2m3m3 l 1 l 2 l 3 = 0 a b/2 d/2 a b/2 d/2 b/2 c e/2 d/2 e/2 f a b/2 d/2 a b/2 d/2 b/2 c e/2 d/2 e/2 f (l 1 m 1 ) (l 2 m 1 +l 1 m 2 ) (l 2 m 2 ) (l 3 m 1 +l 1 m 3 ) (l 2 m 3 +l 3 m 2 ) (l 3 m 3 ) abcdef = 0
9
Method 2: Rearrange, or ‘flatten’ C* ’ stack for all 5 line pairs:stack for all 5 line pairs: Solve for a,b,c,d,e,f with SVD (null space; Ax=0)Solve for a,b,c,d,e,f with SVD (null space; Ax=0) Extract H A H p from C* ’ using SVDExtract H A H p from C* ’ using SVD Undoing H: Metric Rect. 2 C* ’ = H C* H T = a b/2 d/2 a b/2 d/2 b/2 c e/2 d/2 e/2 f abcdef = 0 (l 1 m 1 ) (l 2 m 1 +l 1 m 2 ) (l 2 m 2 ) (l 3 m 1 +l 1 m 3 ) (l 2 m 3 +l 3 m 2 ) (l 3 m 3 )
10
SVD Review: What is it? Matrix Multiply: Ax = bMatrix Multiply: Ax = b –x and b are column vectors –A has m rows, n columns N-dim. input space M-dim. output spaceN-dim. input space M-dim. output space –Rows of A = A 1,A 2,A 3,... = new coordinate axes –Ax = a dot product for each new axis x1x1……xnxnx1x1……xnxn… a 11 … a 1n …… a m1 … a mn = b1b1……bmbmb1b1……bmbm… x1x1x1x1 x2x2x2x2 A2A2A2A2 A1A1A1A1 A3A3A3A3 b3b3b3b3 b2b2b2b2 b1b1b1b1 Ax=b x b Input (N dim) (2D) Output (M-dim) (3D)
11
Sphere of all unit-length x output ellipsoidSphere of all unit-length x output ellipsoid Its axes form orthonormal basis vectors U i :Its axes form orthonormal basis vectors U i : SVD(A) = USV T columns of U = OUTPUT basis vectors SVD Review: What is it? x1x1x1x1 x2x2x2x2 b3b3b3b3 b2b2b2b2 b1b1b1b1 Ax=b 1 Input (N dim.) Output (M dim.) u1u1u1u1 u2u2u2u2 x 1 ellipsoid (disk)
12
SVD Review: What is it? For each U i, make a matching V i that:For each U i, make a matching V i that: –Transforms to U i (with scaling s i ) : s i (A V i ) = U i –Forms an orthonormal basis of input space SVD(A) = USV T columns of V = INPUT basis vectors x1x1x1x1 x2x2x2x2 Ax=b x Input (N dim.) b3b3b3b3 b2b2b2b2 b1b1b1b1 Output (M dim.) u1u1u1u1 u2u2u2u2 v2v2v2v2 v1v1v1v1
13
SVD Review: What is it? Finish: SVD(A) = USV TFinish: SVD(A) = USV T –add ‘missing’ U i or V i, define these s i =0. –Singular matrix S: diagonals are s i : ‘v-to-u scale factors’ –Matrix U, Matrix V have columns U i and V i x1x1x1x1 x2x2x2x2 Ax=b x Input (N dim.) b3b3b3b3 b2b2b2b2 b1b1b1b1 Output (M dim.) u1u1u1u1 u3u3u3u3 u2u2u2u2 v2v2v2v2 v1v1v1v1 A = USV T ‘Find Input & Output Axes, Linked by Scale’
14
‘Let SVDs Explain it All for You’ –cool! U and V are Orthonormal! U -1 = U T, V -1 = V T –Rank(A)? == # of non-zero singular values s i –‘ill conditioned’? Some s i are nearly zero –‘Invert non-square A’ ? A=USV T ; A VS -1 U T = I; so A -1 = V S -1 U T x1x1x1x1 x2x2x2x2 Ax=b x Input (N dim.) b3b3b3b3 b2b2b2b2 b1b1b1b1 Output (M dim.) u1u1u1u1 u3u3u3u3 u2u2u2u2 v2v2v2v2 v1v1v1v1 A = USV T ‘Find Input & Output Axes, Linked by Scale’
15
‘Solve for the Null Space’ Ax=0 –Easy! x is the V i axis that doesn’t affect the output (s i = 0) –are all s i nonzero? then the only answer is x=0. –Null ‘space’ because V i is a DIMENSION--- x = Vi * a –More than 1 zero-valued s i ? null space >1 dimension... x = a V i1 + b V i2 + … x1x1x1x1 x2x2x2x2 Ax=b x Input (N dim.) b3b3b3b3 b2b2b2b2 b1b1b1b1 Output (M dim.) u1u1u1u1 u3u3u3u3 u2u2u2u2 v2v2v2v2 v1v1v1v1 A = USV T ‘Find Input & Output Axes, Linked by Scale’
16
‘Let SVDs Explain it All for You’ SVD finds H for you (?) (pg 35) Book’s Method for finding H A H P from C* ’ : –C* ’ = H C* H T is symmetric; –Assume SVD(C* ’) = USV T = (U S ) I ( S V T ) = ( H ) C* ( H T ) = ( H ) C* ( H T ) –BUT THIS DOESN’T WORK! –( Recall C* = ) A = USV T ‘Find Input & Output Axes, Linked by Scale’ 1 0 0 0 1 0 0 0 0
17
More on SVDs: Handout See Appendix 3, pg 556 (cryptic)See Appendix 3, pg 556 (cryptic) Linear Algebra booksLinear Algebra books Good online introduction: (your handout) Leach, S. “Singular Value Decomposition – A primer,” Unpublished Manuscript, Department of Computer Science, Brown University. http://www.cs.brown.edu/research/ai/dynamics/tutorial/Postscript/Good online introduction: (your handout) Leach, S. “Singular Value Decomposition – A primer,” Unpublished Manuscript, Department of Computer Science, Brown University. http://www.cs.brown.edu/research/ai/dynamics/tutorial/Postscript/ http://www.cs.brown.edu/research/ai/dynamics/tutorial/Postscript/ Google on Singular Value Decomposition...Google on Singular Value Decomposition...
18
Polar Lines and Pole Points Line Conic C’s tangent line L t at point x t by:Line Conic C’s tangent line L t at point x t by: C x t = L t (given x t is on the conic: x t T C x t =0) xtxtxtxt LtLtLtLt C (You can skip this)
19
Polar Lines and Pole Points Line Conic C’s tangent line L t at point x t by:Line Conic C’s tangent line L t at point x t by: C x t = L t (given x t is on the conic: x t T C x t =0) But if x is NOT on the conic? try Cx p = L pBut if x is NOT on the conic? try Cx p = L p xpxpxpxp LpLpLpLp C (You can skip this)
20
Polar Lines and Pole Points Line Conic C’s tangent line L t at point x t by:Line Conic C’s tangent line L t at point x t by: C x t = L t (given x t is on the conic: x t T C x t =0) But if x is NOT on the conic? try Cx p = L pBut if x is NOT on the conic? try Cx p = L p ‘Polar line’ L p = conic at p 1, p 2 (find them?ugly!)‘Polar line’ L p = conic at p 1, p 2 (find them?ugly!) xpxpxpxp LpLpLpLp C p1p1p1p1 p2p2p2p2 (You can skip this)
21
Polar Lines and Pole Points Line Conic C’s tangent line L t at point x t by:Line Conic C’s tangent line L t at point x t by: C x t = L t (given x t is on the conic: x t T C x t =0) But if x is NOT on the conic? try Cx p = L pBut if x is NOT on the conic? try Cx p = L p ‘Polar line’ L p = conic at p 1, p 2 (to find them?ugly!)‘Polar line’ L p = conic at p 1, p 2 (to find them?ugly!) p 1, p 2 tangent lines meet at ‘Pole point’ x pp 1, p 2 tangent lines meet at ‘Pole point’ x p xpxpxpxp LpLpLpLp C p1p1p1p1 p2p2p2p2 (You can skip this)
22
Polar Lines and Pole Points Line Conic C’s tangent line L t at point x t by:Line Conic C’s tangent line L t at point x t by: C x t = L t (given x t is on the conic: x t T C x t =0) But if x is NOT on the conic? try Cx p = L pBut if x is NOT on the conic? try Cx p = L p ‘Polar line’ L p = conic at p 1, p 2 (to find them?ugly!)‘Polar line’ L p = conic at p 1, p 2 (to find them?ugly!) p 1, p 2 tangent lines meet at ‘Pole point’ x pp 1, p 2 tangent lines meet at ‘Pole point’ x p xpxpxpxp LpLpLpLp C p1p1p1p1 p2p2p2p2 Interesting, But why does book show it?
23
Eigen -values,-vectors, Fixed pt & line Formalizes ‘invariant’ notion:Formalizes ‘invariant’ notion: –if x is ‘fixed’ for H, then Hx only scales x H 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.Elaborate topic (but not hard). Skip for now. NEXT CLASS:NEXT CLASS: –The last of P 2 : Find H from 4 point pairs –skip ahead to Chapter 3 (You can skip this)
24
Book Errata Website: http://www.robots.ox.ac.uk/~az/HZbook/HZerrata.html pg. 35, eqn. 1.22 is dubious / erroneous; C* ’ = HC* H T = (H S H A H P ) C* (H S H A H P ) T C* ’ = HC* H T = (H S H A H P ) C* (H S H A H P ) T is the transformed line conic, but book uses C* ’ = (H P H A H S ) C* (H P H A H S ) T instead, AND has error: = But I get: C* ’ = KK T Kv v T K ? (book: ?=0; errata website: ?=v T KK T v) KK T KK T v v T KK T v T KK T v
25
Dubious Book Aggravations: –Similarity transform H S leaves C* unchanged: C* = H S C* H S T –H transforms C* to image space C* ’ by: C* ’ = H C* H T = (H S H A H P ) C* ( H S H A H P ) T –Book claims to derive C* ’ = (H P H A ) C* ( H P H A ) T (!?!?!) Then errs in simplifying to: 1 0 0 0 1 0 0 0 0 KK T Kv v T K 0 *
26
END
27
SVDs and Conics Conics (both C and C*) are symmetric;Conics (both C and C*) are symmetric; SVD of any symmetric A is also symmetric: SVD(A) = USU T !Not Always!SVD of any symmetric A is also symmetric: SVD(A) = USU T !Not Always! All conics’ singular values s i =0,1, or –1.All conics’ singular values s i =0,1, or –1. Singular values classify conic type: (pg 40)Singular values classify conic type: (pg 40) S i values | Equation | Type. (1, 1, 1) (1, 1,-1) (1, 1, 0) (1,-1, 0) (1, 0, 0) x 2 + y 2 + w 2 = 0 x 2 + y 2 - w 2 = 0 x 2 + y 2 = 0 x 2 - y 2 = 0 x 2 = 0 imaginary-only circle/ellipse single real point (0,0,1) 2 lines: x+/- y 2 co-located lines: x=0
28
(recall) H = H S H A H P =(recall) H = H S H A H P = Tedious algebra * (pg35) shows symmetry:Tedious algebra * (pg35) shows symmetry: C* ’ = H C* H T = C* ’ = H C* H T = where K is 2x2 symmetric (affine part: 2DOF) v is 2x1 vector, (projective part: 2DOF) v is 2x1 vector, (projective part: 2DOF) ?But what do K and V really control??But what do K and V really control? KK T Kv v T K 0 * K 0 0 T 1 Undoing H: Metric Rectification s R t 0 T 1 I 0 v T v *==error?!?
29
(recall) H = H S H A H P =(recall) H = H S H A H P = Tedious algebra (pg35) shows symmetry:Tedious algebra (pg35) shows symmetry: C* ’ = H C* H T = C* ’ = H C* H T = where K is 2x2 symmetric (affine part: 2DOF) v is 2x1 vector, (projective part: 2DOF) v is 2x1 vector, (projective part: 2DOF) ?But what do K and V really control??But what do K and V really control? KK T Kv v T K ? K 0 0 T 1 Undoing H: Metric Rectification s R t 0 T 1 I 0 v T v (book: ?=0; errata website: ?=v T KK T v)
30
Undoing H: Metric Rectification OK, then how do we find K and v?OK, then how do we find K and v? (book: ?=0; errata website: ?=v T KK T v) (book: ?=0; errata website: ?=v T KK T v) Choose known-perpendicular line pairs (L i, m i ), then compute by:Choose known-perpendicular line pairs (L i, m i ), 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 H A H P using SVD. KK T Kv v T K ? C* ’ = H C* H T =
31
Method 1a: (pg 36) Assume v=0, solve for K Choose 2 line pairs (L a,m a ) and (L b,m b )Choose 2 line pairs (L a,m a ) and (L b,m b ) Both pairs satisfy L T C* ’ m = 0 or:Both pairs satisfy L T C* ’ m = 0 or: (note x 3 term is ignored!)(note x 3 term is ignored!) ‘flatten’ to one equation:‘flatten’ to one equation: Undoing H: Metric Rect. 1a KK T Kv v T K 0 C* ’ = H C* H T = KK T 0 0 0 0 0 s1 s2 0 s2 s3 0 0 0 0 m1m1m2m2m3m3m1m1m2m2m3m3 l 1 l 2 l 3 =0 l 1 m 1 l 2 m 1 +l 1 m 2 l 2 m 2 s1s1s2s2s3s3s1s1s2s2s3s3 = 0
32
Method 1a: (pg 36) Assume v=0, solve for K ‘Stack’ to combine both line pairs;‘Stack’ to combine both line pairs; Solve for s by SVD: find ‘input null space’ (Ax=0)Solve for s by SVD: find ‘input null space’ (Ax=0) From s make C* ’ = KK T, then extract H A H P using SVD: recall C* ’ = H C* H T, it is symmetric…From s make C* ’ = KK T, then extract H A H P using SVD: recall C* ’ = H C* H T, it is symmetric… Undoing H: Metric Rect. 1a KK T Kv v T K 0 C* ’ = H C* H T = s1 s2 0 s2 s3 0 0 0 0 l a1 m a1 l a2 m a1 +l a1 m a2 l a2 m a2 s1s1s2s2s3s3s1s1s2s2s3s3 = 0 l b1 m b1 l b2 m b1 +l b1 m b2 l b2 m b2
33
Method 1b: (not in book) Assume K=I, solve for v Choose 2 line pairs (L a,m a ) and (L b,m b )Choose 2 line pairs (L a,m a ) and (L b,m b ) These satisfy L T C* ’ m = 0 or:These satisfy L T C* ’ m = 0 or: ‘flatten’ to one equation (messy), stack, solve for v 1,v 2‘flatten’ to one equation (messy), stack, solve for v 1,v 2 Extract H p from C* ’ using SVDExtract H p from C* ’ using SVD Undoing H: Metric Rect. 1b KK T Kv v T K 0 C* ’ = H C* H T = I v I v v T 0 v T 0 1 0 v1 0 1 v2 v1 v2 ? m1m1m2m2m3m3m1m1m2m2m3m3 l 1 l 2 l 3 =0
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.