Title: CS 39549526: Spring 2004
1CS 395/495-26 Spring 2004
- IBMR
- 2-D Conics Introduction
- Jack Tumblin
- jet_at_cs.northwestern.edu
2Intuition for Conics 2D Ellipses
- Still a circle/ellipse after P2 projective
transform - (Better!) every transformed conic is another
conic!
H1
H2
H3
3Intuition for Conics 2D Ellipses
- 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 ?
?
4Conics 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
5Conics 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?...)
6Familiar 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 ranklt3) 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 itplot points for x3 1)
7Point 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
8Dual 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
9Conic 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 - lTCl 0 C is a Dual Conic
- Can you prove this? Try it!
- C C-1 (hint use the boxed equations)
10Degenerate Conics
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 2 complex x vectors and
x1 x2 x3
0
11Conics Key Ideas
- 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
12Conic Weirdness I
- 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
13Conic Weirdness 2
- Circular Points I , J and C?
- C? is a point conic, affected by HAHP only.
- C? is line conic, but is the same matrix (!?!)
- Is same as this outer product IJT JIT
- Intersects L?, the infinity line (proof
L?C?L?0) - Affected by HP and HA only, ( HS does nothing)
- ALL transforms of C? have only 4DOF (pg 33 )
14Conics Angle Measuring
- 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)
(LT C? m) (LT C? L)(mT C? m)
cos(?)
15Conics Angle Measuring
- Matrix H transforms C? to another space
- C? H C? HT
- Angles
- ALSO true for transformed L, 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)
(LT C? m) (LT 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 transformed L, m and C?
(e.g. in image space) LT C? m 0 - Hmmm. L and m are known,
- C? unknown.
- Isnt 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
17Polar Lines and Pole Points
(You can skip this)
xt
C
Lt
- Line Conic Cs tangent line Lt at point xt by
- C xt Lt (given xt is on the conic xtT C
xt0)
18Polar Lines and Pole Points
(You can skip this)
xp
Lp
C
- Line Conic Cs tangent line Lt at point xt by
- C xt Lt (given xt is on the conic xtT C
xt0) - But if x is NOT on the conic? try Cxp Lp
19Polar Lines and Pole Points
(You can skip this)
p1
xp
Lp
C
p2
- Line Conic Cs tangent line Lt at point xt by
- C xt Lt (given xt is on the conic xtT C
xt0) - But if x is NOT on the conic? try Cxp Lp
- Polar line Lp conic at p1, p2 (find
them?ugly!)
20Polar Lines and Pole Points
(You can skip this)
p1
xp
Lp
C
p2
- Line Conic Cs tangent line Lt at point xt by
- C xt Lt (given xt is on the conic xtT C
xt0) - 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
21Polar Lines and Pole Points
p1
Interesting, But why does book show it?
xp
Lp
C
p2
- Line Conic Cs tangent line Lt at point xt by
- C xt Lt (given xt is on the conic xtT C
xt0) - 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
22Question 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 LT C? 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
23END. STOP HERE
24Recall Projective Transform H
2D image (x,y) ?? Homog. coords x,y,1T x
- Apply the 3x3 matrix H x Hx
Homog. coords x x,y,1T ?? 2D image
(x,y)
x
x
x2
(x,y)
y
x
y
y
y
x3
x
x
x
y
(x,y)
x1
x
25Recall Projective Transform H
Goal Find H for Image Rectification
2D image (x,y) ?? Homog. coords x,y,1T x
- Apply the 3x3 matrix H x Hx
Homog. coords x x,y,1T ?? 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
26Recall 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)
28Conics 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 HA and HP from transformed C?
?
?
?
C?
C?
?
?
?
? ?
?
L
m
HS HA HP
2D image space
2D world space
29Undoing H Metric Rect. 1
- C? ?
- First, ignore projective part set v0.
- 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
30Undoing H Metric Rectification
- 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
31Undoing 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
I 0 vT v
K 0 0T 1
?
?
?
?
?
?
?
?
?
?
?
KKT ? Kv ? ? ? vTK ? 0
32Undoing 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
I 0 vT v
K 0 0T 1
?
?
?
?
?
?
?
?
?
?
?
!!!BUT DERIVATION RESULT IS WRONG!!! SKIP
Metric Rectification I pg 35,36!
KKT ? Kv ? ? ? vTK ? 0
33Let SVDs Explain it All for You
- SVD finds H for you (?) (pg 35)
- Books 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 DOESNT WORK!
- ( Recall C? )
A USVT Find Input Output Axes, Linked
by Scale
34Eigen -values,-vectors, Fixed pt line
- 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.
(You can skip this)
35Book Errata Website
- http//www.robots.ox.ac.uk/az/HZbook/HZerrata.htm
l - 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
36Dubious Book Aggravations
- 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
37SVDs 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 x0
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)
38Undoing 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?
K ? 0 ? ? ? 0T ? 1
sR ? t ? ? ? 0T ? 1
I ? 0 ? ? ? vT ? v
KKT ? Kv ? ? ? vTK ? 0
error?!?
39Undoing 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?
K ? 0 ? ? ? 0T ? 1
sR ? t ? ? ? 0T ? 1
I ? 0 ? ? ? vT ? v
KKT ? Kv ? ? ? vTK ? ?
(book ?0 errata website ?vTKKTv)
40Undoing 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 v0, solve for K
- Method 1b (NOT in book)Assume KI, solve for v
- Method 2 Rearrange, solve for full
C? then get HAHP using SVD.
KKT? Kv ? ? ? vTK ? ?
C? H C? HT
41Undoing H Metric Rect. 1a
- Method 1a (pg 36) Assume v0, 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 0 0
0
l1m1 l2m1l1m2 l2m2
0
42Undoing H Metric Rect. 1a
- Method 1a (pg 36) Assume v0, solve for K
- Stack to combine both line pairs
- Solve for s by SVD find input null space
(Ax0) - From s make C? KKT, then extract HAHP using
SVD recall C? H C? HT , it is symmetric
KKT ? Kv ? ? ? vTK ? 0
s1 s2 0 s2 s3 0 0 0 0
C? H C? HT ?
la1ma1 la2ma1la1ma2 la2ma2
0
lb1mb1 lb2mb1lb1mb2 lb2mb2
43Undoing H Metric Rect. 1b
- Method 1b (not in book) Assume KI, 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