cs 395/495-26: spring 2004 ibmr: 2-d conics: introduction jack tumblin [email protected]

43
CS 395/495-26: Spring CS 395/495-26: Spring 2004 2004 IBMR: IBMR: 2-D Conics: 2-D Conics: Introduction Introduction Jack Tumblin Jack Tumblin [email protected] [email protected]

Post on 21-Dec-2015

219 views

Category:

Documents


4 download

TRANSCRIPT

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

CS 395/495-26: Spring 2004CS 395/495-26: Spring 2004

IBMR: IBMR:

2-D Conics: Introduction2-D Conics: Introduction

Jack TumblinJack Tumblin

[email protected]@cs.northwestern.edu

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

Intuition for Conics: 2D EllipsesIntuition for Conics: 2D Ellipses

Still a circle/ellipse after PStill a circle/ellipse after P22 projective transform projective transform

(Better!) every transformed conic is another conic!(Better!) every transformed conic is another conic!

HH11

HH22

HH33

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

Intuition for Conics: 2D EllipsesIntuition for Conics: 2D Ellipses

• Cartesian axis Circle/Ellipse: Cartesian axis Circle/Ellipse: a a xx22 ++ b b yy22 – r– r22 = 0= 0

• PP22 axis Circle/Ellipse: axis Circle/Ellipse: a a xx1122 + b + b xx22

22 – r – r2 2 xx3322 = 0 = 0

• 5 parameters (deg. of freedom):5 parameters (deg. of freedom):– center point center point (cx, cy)(cx, cy)– major, minor axes major, minor axes (1/a, 1/b)(1/a, 1/b)– orientation orientation

1/a1/a1/b1/b

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

Conics: Key IdeasConics: Key Ideas

– ‘‘Conics’Conics’ == intersection of cone & plane:== intersection of cone & plane:– Many possible shapes:Many possible shapes:

circles, ellipses, parabola, hyperbola, circles, ellipses, parabola, hyperbola, degenerate lines & pointsdegenerate lines & points

In PIn P22, Conics have Dual Forms:, Conics have Dual Forms:– ‘‘Point Conics’Point Conics’ defined by points on the curve defined by points on the curve– ‘‘Line Conics’Line Conics’ defined by lines tangent to curve defined by lines tangent to curve

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

Conics written as a MatrixConics written as a Matrix

– All points on any conic solve a 2D quadratic: All points on any conic solve a 2D quadratic: a axx22 + b + bxyxy + c + cyy22 +d +dxx +e +eyy +f = 0 +f = 0

– In homogeneous coordinates: (mpy. all by xIn homogeneous coordinates: (mpy. all by x3322))

aaxx1122 + b + bxx11xx22 + c + cxx22

22 +d +dxx11xx33 +e +exx22xx33 + f + fxx3322 = 0 = 0

xxTTCx = 0Cx = 0– C is symmetric, 5DOF C is symmetric, 5DOF ((not 6;not 6; ignores ignores xx33 scaling) scaling)

– Can find any Can find any CC from 5 homog. points... How? from 5 homog. points... How? (SVD solves Null-space problems (SVD solves Null-space problems easily…)easily…)

aa b/2 d/2 b/2 d/2

b/2 c e/2 b/2 c e/2 d/2 e/2d/2 e/2 f f

xx11

xx22

xx33

= 0 = 0 xx11 x x22 x x33

(and how could conics help you find (and how could conics help you find HH?...)?...)

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

Familiar Conics: Circles, Ellipses...Familiar Conics: Circles, Ellipses...

xxTT C x = 0 C x = 0 oror

• General form of point conic: General form of point conic: aaxx22 + b + bxyxy + c + cyy22 +d +dxx +e +eyy +f = 0 (or) +f = 0 (or)

aaxx1122 + b + bxx11xx22 + c + cxx22

22 +d +dxx11xx33 +e +exx22xx33 + f + fxx3322 = 0 = 0

• Circle at d with radius r:Circle at d with radius r:11xx11

22 + + bxbx11xx22 + + 11xx2222 + +dxdx11xx33 +ex +ex22xx33 –r–r22xx33

22 = 0; = 0;

CCr r ==

• ‘‘Degenerate’ Cases Degenerate’ Cases ((CC rank<3) rank<3):: lines, parabolas, hyperbolae... Example: lines, parabolas, hyperbolae... Example:

aaxx1122 + + bxbx11xx22 + + 00xx22

22 + +dxdx11 +ex +ex22 + f+ fxx3322 = 0; = 0;

aa b/2 d/2 b/2 d/2

b/2 c e/2 b/2 c e/2 d/2 e/2d/2 e/2 f f

xx11

xx22

xx33 = 0 = 0

xx11 x x22 x x33

11 0 0 0 0

0 1 0 0 1 0 0 0 -r0 0 -r22

aa 0 0 0 0

0 0 0 0 0 0 0 0 f0 0 f(Try it—plot points for x3 = 1…)

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

• Matrix Matrix CC makes conic curves from points makes conic curves from points xx: : xxTTCx = 0Cx = 0 CC is a is a ‘point conic’‘point conic’

• The tangent line The tangent line LL for point for point xx is: is: L = C xL = C x

• P2 point conic transformed by H:P2 point conic transformed by H:

C’ = HC’ = H-T-T C H C H-1-1

(messy! requires an invertible H !)(messy! requires an invertible H !)

Point Conics: CPoint Conics: C

LL

xx

Prove it! Use the two equations above…Prove it! Use the two equations above…

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

• Matrix Matrix C*C* makes conic curves from lines makes conic curves from lines LL: : LLT T C* L = 0C* L = 0 CC is a is a ‘line conic’‘line conic’

• The tangent point The tangent point xx for line for line LL is: is: x = C* Lx = C* L

• Projective transform by H is:Projective transform by H is:

C*’ = H C* HC*’ = H C* HT T (better -- no H inversion required)(better -- no H inversion required)

• If If C C is non-singular (rank 3), then is non-singular (rank 3), then C* = CC* = C-1-1

‘‘Dual’ or Line Conics: CDual’ or Line Conics: C

LL

xx

Prove it! Use two equations above…Prove it! Use two equations above…

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

Conic SummaryConic Summary

– Matrix C identifies all the points on a conic: Matrix C identifies all the points on a conic: xxTTCx = 0Cx = 0 CC is a is a ‘point conic’‘point conic’

– Given a point Given a point xx on a conic curve, the on a conic curve, the homog. tangent line homog. tangent line ll is given by is given by l = C xl = C x

– Matrix C* identifies all lines tangent to a conic:Matrix C* identifies all lines tangent to a conic:

llTTC*l = 0C*l = 0 C*C* is a is a ‘Dual ‘Dual Conic’Conic’

– Can you prove this? Try it! Can you prove this? Try it!

C* = CC* = C-1 -1 (hint: use the boxed equations)(hint: use the boxed equations)

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

Degenerate ConicsDegenerate Conics

xxTT C x = 0 C x = 0 oror

• General form of point conic: General form of point conic: aaxx22 + b + bxyxy + c + cyy22 +d +dxx +e +eyy +f = 0 (or) +f = 0 (or)

aaxx1122 + b + bxx11xx22 + c + cxx22

22 +d +dxx11xx33 +e +exx22xx33 + f + fxx3322 = 0 = 0

• Very special ‘degenerate’ case:Very special ‘degenerate’ case:‘infinite radius circle’ as x‘infinite radius circle’ as x330, aka 0, aka CC

11xx1122 + + bxbx11xx22 + + 11xx22

22 + +dxdx11xx33 +ex +ex22xx33 + +00xx3322 = 0 = 0

CC == only solutions to only solutions to xxTT C Cx =0x =0

are 2 are 2 complexcomplex xx vectors: vectors: and and

aa b/2 d/2 b/2 d/2

b/2 c e/2 b/2 c e/2 d/2 e/2d/2 e/2 f f

xx11

xx22

xx33 = 0 = 0

xx11 x x22 x x33

11 0 0 0 0

0 1 0 0 1 0 0 0 00 0 0

1 1 i i 0 0

1 1 -i -i 0 0

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

Conics: Key IdeasConics: Key Ideas

– Transformed conics tell you how Transformed conics tell you how HH will change angles: will change angles:

– one strange, degenerate conic one strange, degenerate conic C*C* can can measuremeasure angle angle

– Angles between line pairs yield transformed Angles between line pairs yield transformed C*C*

2D world space 2D world space

2D image 2D image space space

H = HH = HS S HHA A HHPP

C*C*==11 0 0 0 0

0 1 0 0 1 0 0 0 00 0 0

LL mm m’m’L’L’

C*C*’’==

00

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

Conic Weirdness IConic Weirdness I

‘‘Circular Points’ Circular Points’ I= , J=I= , J= ; and ; and CC ==

– ‘‘Ideal points’Ideal points’; 2 points at infinity / horizon, but…; 2 points at infinity / horizon, but…

– Complex :Complex : real part on real part on xx11 axis, imag. on axis, imag. on xx22

– ““Where infinite circle hits horizon line LWhere infinite circle hits horizon line L [0,0,1]” [0,0,1]”

– Where? imaginary! (infinite x,y axes, maybe?)Where? imaginary! (infinite x,y axes, maybe?)

?WHY BOTHER??WHY BOTHER? – To measure To measure anglesangles in projective space in projective space

– To use angle correspondences to find To use angle correspondences to find HHAA,H,HPP

1 1 i i 0 0

1 1 -i -i 0 0

11 0 0 0 0

0 1 0 0 1 0 0 0 00 0 0

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

Conic Weirdness 2Conic Weirdness 2

‘‘Circular Points’ Circular Points’ I= , J=I= , J= ; and ; and CC ==

• CC is a is a pointpoint conic, affected by conic, affected by HHAAHHP P only.only.

• C*C* is is lineline conic, but is the conic, but is the samesame matrixmatrix (!?!)(!?!)

– Is same as this outer product: Is same as this outer product: IJIJTT + JI + JITT

– Intersects LIntersects L, the infinity line, the infinity line (proof: L(proof: LC*C*LL=0)=0)

– Affected by Affected by HHP P andand HHA A only, ( only, ( HHSS does nothing)does nothing)

ALL transforms of ALL transforms of C*C* have only 4DOF have only 4DOF (pg 33 )(pg 33 )

1 1 i i 0 0

1 1 -i -i 0 0

11 0 0 0 0

0 1 0 0 1 0 0 0 00 0 0

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

Conics: Angle MeasuringConics: Angle Measuring

• Matrix Matrix HH transforms transforms C*C* to another space: to another space:

C*C*’’ == H C*H C* H HT T

Angles:Angles:

– define ‘world space’ define ‘world space’ C*C* as as

– (for any two world-space homogeneous lines) (for any two world-space homogeneous lines) LL and and mm are are perpendicularperpendicular iff iff LLTT C* C* m = 0 m = 0

– Angle Angle between lines between lines LL and and m m given bygiven by

11 0 0 0 0

0 1 0 0 1 0 0 0 00 0 0

(L(LTT C*C* m) m)

(L(LT T C*C* L)(m L)(mT T C*C* m) m)cos(cos() = ) =

(Remember, it is simpler (Remember, it is simpler to transform a line conic)to transform a line conic)

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

Conics: Angle MeasuringConics: Angle Measuring

• Matrix Matrix HH transforms transforms C*C* to another space: to another space:

C*C*’’ == H C*H C* H HT T

Angles:Angles:– ALSO true for ALSO true for transformedtransformed L, mL, m and and C* C*, , so…so…

– If you FIND If you FIND C*C*’’ in image space, you can in image space, you can

measure 2 image-space lines measure 2 image-space lines L’, m’ L’, m’ and find and find the angle the angle between them in world space! between them in world space! Use the same expression:Use the same expression:

(L’(L’TT C* C*’ m’)’ m’)

(L’(L’T T C*C*’ L’) (m’ L’) (mT T C*C*’ m’)’ m’)cos(cos() = ) =

(Remember, it is simpler (Remember, it is simpler to transform a line conic)to transform a line conic)

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

? How can we find ? How can we find C*C*’ without H ?’ without H ?

One Answer: measure perpendicular lines…One Answer: measure perpendicular lines…

– We know 2 world-space lines We know 2 world-space lines LL and and mm are are

perpendicularperpendicular iff iff LLTT C* C* m = 0 m = 0 – Also true for Also true for transformedtransformed L, mL, m and and C* C*: :

(e.g. in image space)(e.g. in image space)

L’L’TT C* C*’’ m’ = 0 m’ = 0

Hmmm. Hmmm. L’ and m’ are known, L’ and m’ are known,

C*C*’ ’ unknown.unknown.

Isn’t this a null-space problem?Isn’t this a null-space problem?

Once we have Once we have C*C*’’ then what? then what?

See any other uses for conics in P2?See any other uses for conics in P2?

11 0 0 0 0

0 1 0 0 1 0 0 0 00 0 0

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

Polar Lines and Pole PointsPolar Lines and Pole Points

• Line Conic Line Conic CC’s tangent line ’s tangent line LLtt at point at point xxtt by: by:

C xC xtt = L = Ltt (given (given xxtt is on the conic: is on the conic: xxttT T C xC xtt=0=0))

xxtt

LLttCC

(You can skip this)(You can skip this)

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

Polar Lines and Pole PointsPolar Lines and Pole Points

• Line Conic Line Conic CC’s tangent line ’s tangent line LLtt at point x at point xtt by: by:

C xC xtt = L = Ltt (given (given xxtt is on the conic: is on the conic: xxttT T C xC xtt=0=0))

• But if But if xx is is NOTNOT on the conic? try on the conic? try CxCxpp = L = Lpp

xxppLLppCC

(You can skip this)(You can skip this)

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

Polar Lines and Pole PointsPolar Lines and Pole Points

• Line Conic Line Conic CC’s tangent line ’s tangent line LLtt at point x at point xtt by: by:

C xC xtt = L = Ltt (given (given xxtt is on the conic: is on the conic: xxttT T C xC xtt=0=0))

• But if But if xx is is NOTNOT on the conic? try on the conic? try CxCxpp = L = Lpp

• ‘‘Polar line’ Polar line’ LLpp = conic at = conic at pp11, p, p22 (find them?ugly!) (find them?ugly!)

xxppLLppCC

pp11

pp22

(You can skip this)(You can skip this)

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

Polar Lines and Pole PointsPolar Lines and Pole Points

• Line Conic Line Conic CC’s tangent line ’s tangent line LLtt at point x at point xtt by: by:

C xC xtt = L = Ltt (given (given xxtt is on the conic: is on the conic: xxttT T C xC xtt=0=0))

• But if But if xx is is NOTNOT on the conic? try on the conic? try CxCxpp = L = Lpp

• ‘‘Polar line’ Polar line’ LLpp = conic at = conic at pp11, p, p22 (to find them?ugly!) (to find them?ugly!)

• pp11, p, p22 tangent lines meet at ‘Pole point’ tangent lines meet at ‘Pole point’ xxpp

xxppLLppCC

pp11

pp22

(You can skip this)(You can skip this)

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

Polar Lines and Pole PointsPolar Lines and Pole Points

• Line Conic Line Conic CC’s tangent line ’s tangent line LLtt at point x at point xtt by: by:

C xC xtt = L = Ltt (given (given xxtt is on the conic: is on the conic: xxttT T C xC xtt=0=0))

• But if But if xx is is NOTNOT on the conic? try on the conic? try CxCxpp = L = Lpp

• ‘‘Polar line’ Polar line’ LLpp = conic at = conic at pp11, p, p22 (to find them?ugly!) (to find them?ugly!)

• pp11, p, p22 tangent lines meet at ‘Pole point’ tangent lines meet at ‘Pole point’ xxpp

xxppLLppCC

pp11

pp22

Interesting, But Interesting, But why does book why does book

show it?show it?

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

Question: Can you apply DLT?Question: Can you apply DLT?

• Choose pairs of lines that are known to be Choose pairs of lines that are known to be perpendicular in perpendicular in worldworld space; measure space; measure those lines in those lines in imageimage space. space.

• Solve for Solve for C*C*’ ’ using L’using L’TT C*C*’’ m’ = 0 m’ = 0

• We also know that We also know that HHC*C*HHTT== C*C*’’

Can you solve for H?Can you solve for H? Zisserman tried, but book method is Zisserman tried, but book method is confused, contains errors, and may be incorrect…confused, contains errors, and may be incorrect…

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

END.END.STOP HERESTOP HERE

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

x’x’

Apply the Apply the 3x3 matrix 3x3 matrix HH

x’ = Hx x’ = Hx

Recall: Projective Transform Recall: Projective Transform HH

xx33

xx22

xx11

xx

yy

x’x’

y’y’

(x,y)(x,y) xx

(x’,y’)(x’,y’)

Homog. coordsHomog. coords x’ =x’ = [x’,y’,1][x’,y’,1]TT

2D image 2D image (x’,y’)(x’,y’)

2D image 2D image (x,y)(x,y)

Homog. coords Homog. coords

[x,y,1][x,y,1]TT = x = x

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

x’x’

Apply the Apply the 3x3 matrix 3x3 matrix HH

x’ = Hx x’ = Hx

Recall: Projective Transform Recall: Projective Transform HH

xx33

xx22

xx11

xx

yy

x’x’

y’y’

(x,y)(x,y) xx

(x’,y’)(x’,y’)

Homog. coordsHomog. coords x’ =x’ = [x’,y’,1][x’,y’,1]TT

2D image 2D image (x’,y’)(x’,y’)

2D image 2D image (x,y)(x,y)

Homog. coords Homog. coords

[x,y,1][x,y,1]TT = x = x

Goal: Find H forGoal: Find H for‘‘Image Rectification’Image Rectification’

‘‘World Plane’World Plane’ ‘‘View Plane’View Plane’

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

Recall: Rectification Undo parts of HRecall: Rectification Undo parts of H

x’ = H xx’ = H x where where H = HH = HS S HHA A HHPP

GOAL: GOAL: Put world plane x’ into view plane xPut world plane x’ into view plane x– Affine Rect.; Affine Rect.; (find only (find only HHPP (2DOF)); (2DOF)); – Metric Rect.;Metric Rect.; (find (find HHA A and and HHP P (6DOF));(6DOF));– Full Rect.;Full Rect.; (find all: (find all: HHSSHHAAHHPP (8DOF)); (8DOF));

METHODS:METHODS:1.1. Affine: ‘Vanishing Point’, Horizon line methodsAffine: ‘Vanishing Point’, Horizon line methods2.2. Metric: Conics & Circular PointsMetric: Conics & Circular Points3.3. Full: 4-point correspondence Full: 4-point correspondence

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

Recall: The bits and pieces of Recall: The bits and pieces of HH

HH has 8 independent variables (DOF) has 8 independent variables (DOF)

• Computer Vision Jargon (2D projective):Computer Vision Jargon (2D projective):Isometry Isometry --3DOF(2D translate --3DOF(2D translate ttxx,t,tyy; 2D rotate ; 2D rotate zz; ); )

Similarity Similarity --4DOF (add uniform scale --4DOF (add uniform scale s;s;))

AffineAffine --6DOF (add orientable scale --6DOF (add orientable scale ss,/s, s,/s, s/s/s))

ProjectiveProjective--8DOF (changes --8DOF (changes xx33; 3D-rotation-like); 3D-rotation-like)

Rectification “up to a Similarity” (finds Rectification “up to a Similarity” (finds HHPP, H, HAA))

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

Conics: Key IdeasConics: Key Ideas

– Transformed conics tell you how Transformed conics tell you how HH changes angles changes angles

– one strange, degenerate conic one strange, degenerate conic C*C* measures angle measures angle

– Angles between line pairs yield transformed Angles between line pairs yield transformed C*C*

– We can compute We can compute HHAA and and HHP P from transformed from transformed C*C*

2D world space 2D world space

2D image 2D image space space

HHS S HHA A HHPP

C*C*== C*C*’’==11 0 0 0 0

0 1 0 0 1 0 0 0 00 0 0

LL MMmmLL

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

Undoing H: Metric Rect. 1Undoing 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 Second, Use LLTT’ ’ C*C*’ m’ = 0 ’ m’ = 0 to solve for to solve for KK

KKKKT T KvKv

vvTTKK ss

2D world space 2D world space

2D image 2D image space space

HHS S HHA A HHPP

LL MMmmLL

KKKKTT

00

00 ssaka ‘Weak Perspective’aka ‘Weak Perspective’

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

Undoing H: Metric RectificationUndoing H: Metric Rectification

• C*C*’’ has only 4DOFhas only 4DOF (before,after (before,after ANYANY H) H)

• All C*All C*’ ’ DOF are contained in (HDOF are contained in (HA A HHPP))

• SVD can convert C*SVD can convert C*’ to ’ to (H(HA A HHPP) matrix!) matrix!

• Task is then Task is then “find “find C*C*’’, then use it to find , then use it to find HH””

2D world space 2D world space

2D image 2D image space space

HHS S HHA A HHPP

C*C*== C*C*’’==

LL MMmmLL

00

11 0 0 0 0

0 1 0 0 1 0 0 0 00 0 0

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

Undoing H: Metric Rect. 1Undoing H: Metric Rect. 1

• H = HH = HSS H HA A HHP P ==

• Book shows how to write transformed Book shows how to write transformed C*C*

as (simple, tedious):as (simple, tedious):

C*C*’ =’ =

where where KK is 2x2 symmetric (affine part: 2DOF) is 2x2 symmetric (affine part: 2DOF) vv is 2x1 vector, (projective part: 2DOF) is 2x1 vector, (projective part: 2DOF)

ssRR tt

00TT 11

II 00

vvTT vv

KK 00

00TT 11

KKKKT T KvKv

vvTTKK 00

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

Undoing H: Metric Rect. 1Undoing H: Metric Rect. 1

• H = HH = HSS H HA A HHP P ==

• Book shows how to write transformed Book shows how to write transformed C*C*

as (simple, tedious):as (simple, tedious):

C*C*’ =’ =

where where KK is 2x2 symmetric (affine part: 2DOF) is 2x2 symmetric (affine part: 2DOF) vv is 2x1 vector, (projective part: 2DOF) is 2x1 vector, (projective part: 2DOF)

ssRR tt

00TT 11

II 00

vvTT vv

KK 00

00TT 11

KKKKT T KvKv

vvTTKK 00

!!!BUT DERIVATION & !!!BUT DERIVATION & RESULT IS WRONG!!! RESULT IS WRONG!!!

SKIP SKIP

‘‘Metric Rectification I’ pg 35,36!Metric Rectification I’ pg 35,36!

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

‘‘Let SVDs Explain it All for You’Let SVDs Explain it All for You’

SVD finds H for you (?) SVD finds H for you (?) (pg 35) (pg 35)

Book’s Method for finding Book’s Method for finding HHAAHHPP from from C*C*’ :’ :

– C*C*’’ = H C*= H C* H HTT is symmetric; is symmetric;

– Assume SVD(Assume SVD(C*C*’) = USV’) = USVTT = ( = (U S ) I ( S VU S ) I ( S VTT ) )

= ( H ) C*= ( H ) C*

( H( HTT) ) – BUT THIS DOESN’T WORK!BUT THIS DOESN’T WORK!

– ( Recall C*( Recall C* = ) = )A = A = USVUSVT T ‘Find Input & Output Axes, Linked by Scale’‘Find Input & Output Axes, Linked by Scale’

11 0 0 0 0

0 1 0 0 1 0 0 0 00 0 0

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

Eigen -values,-vectors, Fixed pt & lineEigen -values,-vectors, Fixed pt & line

• Formalizes ‘invariant’ notion:Formalizes ‘invariant’ notion:– if x is ‘fixed’ for H, then Hx only scales xif x is ‘fixed’ for H, then Hx only scales x

H x =H x = xx (( is a constant scale is a constant scale factor)factor)

– xx is an ‘eigenvector’, is an ‘eigenvector’, is its ‘eigenvalue’is its ‘eigenvalue’

– again, SVD helps you find them.again, SVD helps you find them.

• Elaborate topic (but not hard). Skip for now.Elaborate topic (but not hard). Skip for now.

(You can skip this)(You can skip this)

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

Book Errata Website:Book Errata Website:http://www.robots.ox.ac.uk/~az/HZbook/HZerrata.htmlhttp://www.robots.ox.ac.uk/~az/HZbook/HZerrata.html

pg. 35, eqn. 1.22 is dubious / erroneous;pg. 35, eqn. 1.22 is dubious / erroneous;

C*C*’ = HC*’ = HC*HHTT = (H = (HSSHHAAHHPP) C*) C* (H(HSSHHAAHHPP))TT

is the transformed line conic, but book uses is the transformed line conic, but book uses C* C*’ = (H’ = (HPPHHAAHHSS) C*) C* (H(HPPHHAAHHSS))TT instead, AND has instead, AND has

error:error:

==

But I get: But I get:

C*C*’ = ’ =

KKKKT T KvKv

vvTTKK ??

(book: (book: ?=0?=0; ; errata website: errata website: ??

=v=vTTKKKKTTvv))

KKKKT T KKKKTTvv

vvTTKKKKTT vvTTKKKKTTvv

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

Dubious Book Aggravations:Dubious Book Aggravations:

– Similarity transform Similarity transform HHSS leaves leaves C*C* unchanged:unchanged:

C*C* == HHSS C* C* H HSST T

– HH transforms transforms C*C* to image space to image space C*C*’’ by: by:

C*C*’’ == H C*H C* H HTT = ( = (HHSS H HA A HHPP) C*) C* ((HHSS H HA A HHPP))TT

– Book claims to derive Book claims to derive

C*C*’ = ’ = (H(HP P HHAA) C*) C* ((HHP P HHAA))T T (!?!?!)(!?!?!)

Then errs in simplifying to:Then errs in simplifying to:

11 0 0 0 0

0 1 0 0 1 0 0 0 00 0 0

KKKKT T KvKv

vvTTKK 00**

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

SVDs and ConicsSVDs 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 of any symmetric A is also symmetric:SVD(A) = USUSVD(A) = USUTT !Not Always! !Not Always!

• Find conics’ singular values’ sign: Find conics’ singular values’ sign: ssii =0,1, or –1, to classify conic type: =0,1, or –1, to classify conic type: (pg 40)(pg 40)

SSii values | Equation | Type . values | Equation | Type .

(1, 1, 1)(1, 1, 1)(1, 1,-1)(1, 1,-1)(1, 1, 0)(1, 1, 0)(1,-1, 0)(1,-1, 0)(1, 0, 0)(1, 0, 0)

xx22 + y + y22 + w + w22 = 0 = 0xx22 + y + y22 - w - w22 = 0 = 0 xx22 + y + y22 = 0 = 0xx22 - y - y22 = 0 = 0xx2 2 = 0 = 0

imaginary-only imaginary-only circle/ellipse circle/ellipse single real point (0,0,1)single real point (0,0,1)2 lines: x+/- y2 lines: x+/- y2 co-located lines: x=0 2 co-located lines: x=0

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

•(recall)(recall)H = H = HHSS H HA A HHP P ==

• Tedious algebraTedious algebra** (pg35)(pg35) shows symmetry: shows symmetry:

C*C*’ ’ == H C*H C* H HT T ==

where where KK is 2x2 symmetric ( is 2x2 symmetric (affine partaffine part: 2DOF): 2DOF)

vv is 2x1 vector, ( is 2x1 vector, (projective partprojective part: 2DOF): 2DOF)• ?But what do ?But what do KK and and VV really control? really control?

KKKKT T KvKv

vvTTKK 00**

K K 00

00T T 11

Undoing H: Metric RectificationUndoing H: Metric Rectification

ssR R tt

00T T 11

I I 00 vvT T vv

*==error?!?*==error?!?

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

•(recall)(recall)H = H = HHSS H HA A HHP P ==

• Tedious algebra Tedious algebra (pg35)(pg35) shows symmetry: shows symmetry:

C*C*’ ’ == H C*H C* H HT T ==

where where KK is 2x2 symmetric ( is 2x2 symmetric (affine partaffine part: 2DOF): 2DOF)

vv is 2x1 vector, ( is 2x1 vector, (projective partprojective part: 2DOF): 2DOF)• ?But what do ?But what do KK and and VV really control? really control?

KKKKT T KvKv

vvTTKK ??

K K 00

00T T 11

Undoing H: Metric RectificationUndoing H: Metric Rectification

ssR R tt

00T T 11

I I 00 vvT T vv

(book: (book: ?=0?=0; ; errata website: errata website: ??

=v=vTTKKKKTTvv))

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

Undoing H: Metric RectificationUndoing H: Metric Rectification

• OK, then how do we find OK, then how do we find KK and and vv??

• (book: (book: ?=0?=0; ; errata website: errata website: ?=v?=vTTKKKKTTvv))

• Choose known-perpendicular line pairsChoose known-perpendicular line pairs ((LLii, , mmii)),,

then compute by:then compute by:– Method 1a: Method 1a: (pg 36)(pg 36) Assume v=0, solve for KAssume v=0, solve for K– Method 1b: Method 1b: (NOT in book)(NOT in book)Assume K=I, solve for v Assume K=I, solve for v

– Method 2:Method 2: Rearrange, solve for full Rearrange, solve for full C*C*’’then get Hthen get HAAHHPP using SVD. using SVD.

KKKKTT KvKv

vvTTKK ??C*C*’ ’ == H C*H C* H HT T ==

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

Method 1a: Method 1a: (pg 36)(pg 36) Assume v=0, solve for KAssume v=0, solve for K

• Choose 2 Choose 2 line pairs ( line pairs (LLaa,m,maa) and () and (LLbb,m,mbb))

• Both pairs satisfy Both pairs satisfy LLT T C*C*’’ m = 0 m = 0 or: or:• (note x(note x33 term is ignored!) term is ignored!)

• ‘‘flatten’ to one equation:flatten’ to one equation:

Undoing H: Metric Rect. 1aUndoing H: Metric Rect. 1a

KKKKT T KvKv

vvTTKK 00C*C*’ ’ == H C*H C* H HT T = =

KKKKT T 00

00 00

s1 s2 0s1 s2 0s2 s3 0s2 s3 0

0 00 0 00

mm11

mm22

mm33 ll11 l l22 l l33 =0=0

ll11mm11 l l22mm11+l+l11mm22 l l22mm22

ss11

ss22

ss33 = 0= 0

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

Method 1a: Method 1a: (pg 36)(pg 36) Assume v=0, solve for KAssume v=0, solve for K

• ‘‘Stack’ to combine both line pairs;Stack’ to combine both line pairs;

• Solve for Solve for ss by SVD: find ‘input null space’ ( by SVD: find ‘input null space’ (Ax=0Ax=0) ) • From From ss make make C*C*’’ = = KKKKTT, then extract , then extract HHAAHHPP using using

SVD: SVD: recall recall C*C*’ ’ == H C*H C* H HTT , , it is symmetric…it is symmetric…

Undoing H: Metric Rect. 1aUndoing H: Metric Rect. 1a

KKKKT T KvKv

vvTTKK 00C*C*’ ’ == H C*H C* H HT T = =

s1 s2 0s1 s2 0s2 s3 0s2 s3 0

0 00 0 00

lla1a1mma1a1 l la2a2mma1a1+l+la1a1mma2a2 l la2a2mma2a2ss11

ss22

ss33 = 0= 0

llb1b1mmb1b1 l lb2b2mmb1b1+l+lb1b1mmb2b2 l lb2b2mmb2b2

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

Method 1b: Method 1b: (not in book)(not in book) Assume K=I, solve for vAssume K=I, solve for v

• Choose 2 Choose 2 line pairs ( line pairs (LLaa,m,maa) and () and (LLbb,m,mbb))

• These satisfy These satisfy LLT T C*C*’’ m = 0 m = 0 or: or:

• ‘‘flatten’ to one equation flatten’ to one equation (messy)(messy), stack, solve for , stack, solve for vv11,v,v22

• Extract Extract HHpp from from C*C*’ ’ using SVDusing SVD

Undoing H: Metric Rect. 1bUndoing H: Metric Rect. 1b

KKKKT T KvKv

vvTTKK 00C*C*’ ’ == H C*H C* H HT T = =

I I vv

vvTT 00

1 0 v11 0 v10 1 v20 1 v2v1 v2v1 v2 ??

mm11

mm22

mm33 ll11 l l22 l l33 =0=0