cs 395/495-26: spring 2003 ibmr: week 4b chapter 3: estimation & accuracy jack tumblin...

33
CS 395/495-26: Spring CS 395/495-26: Spring 2003 2003 IBMR: Week 4B IBMR: Week 4B Chapter 3: Chapter 3: Estimation & Accuracy Estimation & Accuracy Jack Tumblin Jack Tumblin [email protected] [email protected]

Post on 19-Dec-2015

220 views

Category:

Documents


0 download

TRANSCRIPT

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

IBMR: Week 4B IBMR: Week 4B

Chapter 3:Chapter 3:Estimation & AccuracyEstimation & Accuracy

Jack TumblinJack [email protected]@cs.northwestern.edu

RemindersReminders

• Project A due today; (before midnight)Project A due today; (before midnight)Homework submission instructions on Homework submission instructions on

websitewebsite

• Project B assigned today 4/24 (on website) Project B assigned today 4/24 (on website) Due 5/1 (1 week to complete it)Due 5/1 (1 week to complete it)

• Take-Home Midterm starts 5/1 (Next Thurs.)Take-Home Midterm starts 5/1 (Next Thurs.)Due Thurs 5/8 (1 week to complete it).Due Thurs 5/8 (1 week to complete it).

[ 0 0 0 -w’x -w’y -w’w y’x y’y y’w] [ 0 0 0 -w’x -w’y -w’w y’x y’y y’w] = 0 = 0[w’x w’y w’w 0 0 0 -x’x -x’y -x’w][w’x w’y w’w 0 0 0 -x’x -x’y -x’w]

.................or written in book’s vector notation .................or written in book’s vector notation (pg 71, 3.1)(pg 71, 3.1)..........................

[[ 00TT --ww’’i i xxiiTT yy’’I I xxii

TT ]][[ ww’’i i xxii

TT 00TT - -xx’’i i xxiiTT ]]

[ -[ -yy’’i i xxiiTT --xx’’i i xxii

TT 00TT ]]

Direct Linear Tranform (DLT)Direct Linear Tranform (DLT)

• For each point pair (xFor each point pair (xii,x,xii’) Solve Hx ’) Solve Hx x’ = 0x’ = 0– Robust! Accepts Robust! Accepts anyany scale (x scale (x33=w=w1, x1, x33’=w’’=w’1), finds 1), finds anyany HH

• ‘‘Vectorize’; make 2 rows of Vectorize’; make 2 rows of AA per point pair per point pair

• Solve Solve AAiih = 0 h = 0 stacked up…stacked up…

hh11

hh22

hh33

Direct Linear Tranform (DLT)Direct Linear Tranform (DLT)

Solve Solve Ah = 0 Ah = 0 using Singular Value Decomp.using Singular Value Decomp.

• SVD(A) = USVSVD(A) = USVTT

• Solution: h is VSolution: h is V88, the, the last column of Vlast column of V

Assumes rank of A is 8; singular value sAssumes rank of A is 8; singular value s88 0 0

xx11

xx22

Ax=bAx=b

xx

Input (9 dim.)Input (9 dim.)

bb33

bb22

bb11

Output (8 dim.)Output (8 dim.)

uu11

uu33

uu22

vv22 vv11

‘‘Find Input & Output Axes, Linked by Scale’Find Input & Output Axes, Linked by Scale’

A = A = USVUSVT T

vv33

Adding More MeasurementsAdding More Measurements

If we use If we use >4>4 point correspondences? point correspondences?

Quick-and-sloppy:Quick-and-sloppy:– Adds row pairs to our 8x9 matrix A: Adds row pairs to our 8x9 matrix A: AA··h = 0h = 0– Use SVD to find Null space Use SVD to find Null space (Always gives an answer!)(Always gives an answer!)

– Result:Result: ‘Least squares’ solution ‘Least squares’ solution• minimizes ‘minimizes ‘algebraic distancesalgebraic distances’ ’ ЄЄii

22 between point pairs.between point pairs.

|| || A hA h || ||22 = = ЄЄ22 = = || tall, near-zero vector |||| tall, near-zero vector ||2 2 = =

= = ii ЄЄii22 = where = where,,ЄЄii

22 is error for is error for ii-th pt. correspondence: -th pt. correspondence:

ЄЄii22 = || Hx= || Hxii x xii’ ||’ ||2 2 = = || (2 rows of A)·h |||| (2 rows of A)·h ||2 2 = ‘algebraic distance’= ‘algebraic distance’

ЄЄ1122 + +

ЄЄ2222 + +

ЄЄ3322 + +

……

Adding More MeasurementsAdding More Measurements

• 2D‘Algebraic Distance’ ?2D‘Algebraic Distance’ ? No geometric meaning! No geometric meaning!

• 2D ‘Geometric Distance’ d2D ‘Geometric Distance’ d((aa,,bb))22 is better: is better: measurable length in input or output spacemeasurable length in input or output space

if if aa = (a = (a11 a a22 a a33) and ) and bb = (b = (b11 b b2 2 b b33), then define), then define

Turns out that: Turns out that: (for P(for P22))

( - )( - )22 + + ( - )( - )22 dd((aa,,bb))22 = = aa11

aa33

bb22

bb33

bb11

bb33

aa22

aa33

dd((aa,,bb) = d) = dalgebraicalgebraic((aa,,bb))aa33··bb33

Adding More MeasurementsAdding More Measurements

Overall Strategy:Overall Strategy:• Overconstrain the answer Overconstrain the answer HH

– Collect extra measurements (>4 point pairs, etc. …)Collect extra measurements (>4 point pairs, etc. …)– expectexpect errors; use adjustable ‘ errors; use adjustable ‘estimatesestimates’’ x x

• Compute a 1Compute a 1stst solution (probably by SVD) solution (probably by SVD)

• Compute error Compute error d(Hx, x’)d(Hx, x’)22, and use this to…, and use this to…

• ‘‘Tweak’ answer Tweak’ answer HH andand estimates estimates xx

• Compute new answerCompute new answer

• Stop when error < useful thresholdStop when error < useful threshold

^

^

^

^

• One-Sided: One-Sided: – Perfect inputs Perfect inputs xxii, Flawed outputs , Flawed outputs xxii’’

– Find Find HH to minimize to minimize i i d(Hxd(Hxii, x, xii’)’)22

• Two-sided (symmetric): Two-sided (symmetric): – Flawed input Flawed input xxii, Flawed output , Flawed output xxii’’– Interleave: find best Interleave: find best HH,find best ,find best HH-1-1 to to

minimize minimize i i d(Hxd(Hxii, x, xii’)’)22 + + iid(xd(xii, H, H-1-1xxii’)’)22

• Reprojection:Reprojection:– both input both input xxii and output and output xxii’’ have errors have errors– Unify ‘Unify ‘estimatesestimates’ of ’ of allall: : xxii, , xxii’’ andand HH

– DefineDefine H H for perfect matches: for perfect matches: HxHxi i == xxii’’

– Minimize Minimize estimates estimates .vs. real: .vs. real: i i d(xd(xii, x, xii))2 2 + d(x’+ d(x’ii, x, xii’)’)22

Error Measures & CorrectionsError Measures & Corrections

HH^

HH

H, H, HH-1-1

HH

IDEAL:IDEAL:xxii x’x’ii

^

^ ^

^ ^ ^

^ ^

HOW? Reprojection in RHOW? Reprojection in R44

• Rearrange Rearrange Each point pair to make a 4-vector Each point pair to make a 4-vector XXii: : i-th point pair xi-th point pair x ii,x,xii’ ’ XXii= (x= (xii,x,xii’) = [x,y,x’,y’]’) = [x,y,x’,y’]TT (assume w=w’=1)(assume w=w’=1)

• 1) Define an 1) Define an RR44 ‘measurement space’ for all ‘measurement space’ for all XXii

– (CAREFUL! this is NOT homogeneous P3: it’s true 4-D)(CAREFUL! this is NOT homogeneous P3: it’s true 4-D)– holds all possible point pairs, from perfect to horridholds all possible point pairs, from perfect to horrid

• 2) Find the “shape of perfection” for an 2) Find the “shape of perfection” for an HH in in RR44::– WhatWhat XXi i points in points in RR4 4 are an error-free fit to are an error-free fit to H?H?

– .e.g. find all.e.g. find all XXi i points where points where H xH xii xxii’ = 0’ = 0

– Choose an ‘Choose an ‘estimateestimate’’ XXii that is on this shape that is on this shape

• 3) Find nearest 3) Find nearest estimateestimate XXii for measured point for measured point X Xii

^

^

Find “Perfect Shape of H” in RFind “Perfect Shape of H” in R44::

• Rewrite Rewrite oneone row of row of Ah=0Ah=0 using using XXii and get… and get…

one multilinear quadric in Rone multilinear quadric in R4:4:

• HH sets sets 22 rows rows22 quadrics quadrics a ‘variety’ a ‘variety’ vvHH

(‘variety’ = a collection of shapes in higher dimensions)(‘variety’ = a collection of shapes in higher dimensions)

• ““Each H forms a variety in REach H forms a variety in R44””

0 0 a b0 0 c d 0 0 0 0

eeffgghh

XXTT Q QXX + + XXTTP + P + CC = 0 = 0

XXTT X+ XX+ XTT ++ CC = 0= 0

(a,b,c,d,e,f,g,h,C are scalar constants)(a,b,c,d,e,f,g,h,C are scalar constants)

QQ PP

(assumes w=w’=1)(assumes w=w’=1)

xxyyx’x’y’y’

XXii ==

Find “Perfect Shape of H” in RFind “Perfect Shape of H” in R44::

• RecallRecall a point pair a point pair XXii sets two rows of sets two rows of Ah=0Ah=0::

• Rewrite Rewrite oneone row of row of Ah=0Ah=0 using using XXii = = and get… and get…

-a (messy) quadric in R-a (messy) quadric in R44, but, but

-‘multilinear’; (-‘multilinear’; (only zeros are squared)only zeros are squared)

--simpler if you include w’...simpler if you include w’...

[ 0 0 0 -w’x -w’y -w’w y’x y’y y’w] [ 0 0 0 -w’x -w’y -w’w y’x y’y y’w] = 0= 0[w’x w’y w’w 0 0 0 -x’x -x’y -x’w][w’x w’y w’w 0 0 0 -x’x -x’y -x’w]

hh11

hh22

hh33

0 0 a b0 0 c d 0 0 0 0

eeffgghh

XXTT X+ XX+ XTT ++ CC = 0= 0

QQ PP

xxyyx’x’y’y’

(assumes w=w’=1)(assumes w=w’=1)

a,b,c,d,e,f,g,h,C are scalar constants from a,b,c,d,e,f,g,h,C are scalar constants from HH?can you find them??can you find them?

XXTT Q QXX + + XXTTP + P + CC = 0 = 0

Find “Perfect Shape of H” in RFind “Perfect Shape of H” in R44::

• RecallRecall a point pair a point pair XXii sets two rows of sets two rows of Ah=0Ah=0::

• Rewrite Rewrite oneone row of row of Ah=0Ah=0 using using XXii = = and get… and get…

-a (messy) quadric in R-a (messy) quadric in R44, but, but

-‘multilinear’; (-‘multilinear’; (only zeros are squared)only zeros are squared)

-simpler if you include w’...-simpler if you include w’...

[ 0 0 0 -w’x -w’y -w’w y’x y’y y’w] [ 0 0 0 -w’x -w’y -w’w y’x y’y y’w] = 0= 0[w’x w’y w’w 0 0 0 -x’x -x’y -x’w][w’x w’y w’w 0 0 0 -x’x -x’y -x’w]

hh11

hh22

hh33

0 0 a b0 0 c d 0 0 0 0

eeffgghh

XXTT X+ XX+ XTT ++ CC = 0= 0

QQ PP

xxyyx’x’y’y’w’w’

(assumes w=w’=1)(assumes w=w’=1)

a,b,c,d,e,f,g,h,C are scalar constants from a,b,c,d,e,f,g,h,C are scalar constants from HH?can you find them??can you find them?

XXTT Q QXX + + XXTTP + P + CC = 0 = 0

! NO !! NO !It’s simpler if you It’s simpler if you

include w’...include w’...

• For the For the i-thi-th point pair, DLT makes 2 rows point pair, DLT makes 2 rows AAii

• In RIn R44, point pair is , point pair is XXii = [x y x’ y’] = [x y x’ y’]TT (assume w=w’=1)(assume w=w’=1)

• Augment Augment XXii with with w’w’; then ; then RR4+4+ quadrics are: quadrics are:

XXT T Q X=0Q X=0 or or = 0 = 0

Find “Perfect Shape of H” in RFind “Perfect Shape of H” in R44::

00TT - -ww’’i i xxiiTT yy’’I I xxii

TT

ww’’i i xxiiTT 0 0TT - -xx’’i i xxii

TT

- -yy’’i i xxiiTT --xx’’i i xxii

TT 0 0T T

hh11

hh22

hh33

==

xxyyx’x’y’y’w’w’

QQx y x’ y’ w’x y x’ y’ w’

AAiih= h= 00 00

0000

• For the For the i-thi-th point pair, DLT makes 2 rows point pair, DLT makes 2 rows AAii::

• Write each row as an RWrite each row as an R4+4+ quadric: quadric: XXT T QQii X=0 X=0

Find “Perfect Shape of H” in RFind “Perfect Shape of H” in R44::

00TT - -ww’’i i xxiiTT yy’’I I xxii

TT

ww’’i i xxiiTT 0 0TT - -xx’’i i xxii

TT

- -yy’’i i xxiiTT --xx’’i i xxii

TT 0 0T T

hh11

hh22

hh33

==AAii

h= h= ЄЄiiRow 1Row 1Row 2Row 2Row 3Row 3

0 0 0 h0 0 0 h3131 -h -h2121

0 0 0 h0 0 0 h3232 -h -h2222

0 0 0 0 00 0 0 0 00 0 0 00 0 0 0 whwh2222

0 0 0 00 0 0 0 wh wh3333

0 0 -h0 0 -h31 31 0 h0 h1111

0 0 -h0 0 -h32 32 0 h0 h1212

0 0 0 0 0 0 0 -w h0 -w h3333

0 0 00 0 0 0 0 0 0

0 0 00 0 0 0 0 ’wh’wh1313

0 0 h0 0 h21 21 -h-h1111 0 0

0 0 h0 0 h22 22 -h-h12 12 0 0

0 0 0 0 0 0 0 w h0 w h2323

0 0 00 0 0 0 w h 0 w h1313

0 0 00 0 0 0 0 0 0

QQi1i1 for Row 1for Row 1 QQi2i2 for Row 2for Row 2 QQi3i3 for Row 3 for Row 3

000000

• For the For the i-thi-th point pair, DLT makes 2 rows point pair, DLT makes 2 rows AAii::

RR44 Quadrics for the Variety Quadrics for the Variety vvHH

0 0 0 h0 0 0 h3131 -h -h2121

0 0 0 h0 0 0 h3232 -h -h2222

0 0 0 0 00 0 0 0 00 0 0 00 0 0 0 whwh2222

0 0 0 00 0 0 0 wh wh3333

0 0 -h0 0 -h31 31 0 h0 h1111

0 0 -h0 0 -h32 32 0 h0 h1212

0 0 0 0 0 0 0 -w h0 -w h3333

0 0 00 0 0 0 0 0 0

0 0 00 0 0 0 0 w hw h1313

0 0 h0 0 h21 21 -h-h1111 0 0

0 0 h0 0 h22 22 -h-h12 12 0 0

0 0 0 0 0 0 0 w h0 w h2323

0 0 00 0 0 0 w h 0 w h1313

0 0 00 0 0 0 0 0 0

QQi1i1 for Row 1for Row 1 QQi2i2 for Row 2for Row 2 QQi3i3 for Row 3 for Row 3

• HH sets sets 22 rows rows22 quadrics quadrics a ‘variety’ a ‘variety’ vvHH

- “variety” = a collection of shapes in higher dimensions- “variety” = a collection of shapes in higher dimensions

- “Each H forms a variety in R- “Each H forms a variety in R44” means the perfect shape of ” means the perfect shape of H is the intersection of 2 (or 3) quadricsH is the intersection of 2 (or 3) quadrics

Variety of H is Variety of H is vvHH is two quadrics is two quadrics XXT T QQii X=0 X=0

Reprojection: The Big IdeaReprojection: The Big Idea

• Given Given HH, find its , find its RR44 ‘variety’ ‘variety’ vvHH (its 2 quadrics)(its 2 quadrics)

• For each measured For each measured XXii, find nearest , find nearest estimateestimate XXii

on on vvHH by ‘projection’ by ‘projection’

• VERYVERY nice result (robust!): nice result (robust!):– Minimizes input, output geometric errorMinimizes input, output geometric error– Is also the ‘ML’ (maximum likelihood) estimateIs also the ‘ML’ (maximum likelihood) estimate– Better than DLT: invariant to origin, scaling, similarity,Better than DLT: invariant to origin, scaling, similarity,

BUTBUT

in Rin R44, finding ‘nearest , finding ‘nearest estimateestimate’ d’ d((XXii, , vvHH) is a mess!) is a mess!

Look at simplified case…Look at simplified case…

^

Try RTry R22 (not R (not R44) first…) first…

Find dFind d((XXii, , vvHH) for R) for R22 to an ‘x to an ‘x22 family’ curve: family’ curve:

– Instead of (x,y)Instead of (x,y)(x’,y’) correspondence, (x’,y’) correspondence, (x)(x)(y)(y)

– Instead of XInstead of Xii = (x,y,x’,y’), use = (x,y,x’,y’), use XXii = (x,y) = (x,y)

– Replace 4D ‘Variety’ Replace 4D ‘Variety’ vvHH with 2D conic curve with 2D conic curve CC

– EstimateEstimate XXii is on conic: is on conic: XXiiT T C XC Xii = 0 = 0

– LineLine from Xfrom Xii to X to Xii is is to C tangent to C tangent

– Finding XFinding Xii from X from Xii, C is, C is root-finding!root-finding!

XXii

XXii

vvHH

^

^ ^ ^

^

^

RR44: Sampson Error Approx.: Sampson Error Approx.

• Sampson error’s Sampson error’s estimateestimate: : XXii = X = Xii + + XX

• Re-name DLT resultRe-name DLT result A Aiihh = = ЄЄi i asas CCHH(X) = (X) = ЄЄii = =

(Note: (Note: CCHH(X) is a stack of (X) is a stack of 2(or 3)2(or 3) rows of A rows of A ))

• Use Taylor Series Approx:Use Taylor Series Approx:

CCHH(X(Xii + + XX) ) CCHH(X) + (X) + XX + … + …

• Find Find xx for error for error 0:0:

CCHH(X(Xii + + XX) ) 0 0 == ЄЄii + + XX

• But How? But How? (2-,3- and 4-vectors here!)(2-,3- and 4-vectors here!)

CCHH(X)(X)

xx

CCHH(X(Xii))

XX ЄЄii

XXiiXX

CCHH(X(Xii))

XX

^ЄЄi1i1

ЄЄi2i2

ЄЄi3i3

RR44 Solutions: Sampson Error Solutions: Sampson Error

The The CCHH(X)(X) = = ==error is a vector ==error is a vector polynomialpolynomial

• Do Taylor Series at measured point Do Taylor Series at measured point XXii::

– Follow -(error gradient) directionFollow -(error gradient) direction– distance*grad = error distance*grad = error

• EstimateEstimate X Xi i = X= Xii + + xx

• Error vector Error vector xx = -J = -JTT(JJ(JJTT))-1-1Є Є (J = partial deriv. matrix...)(J = partial deriv. matrix...)

ЄЄ11

ЄЄ22

XXii

CC HH(X

)(X)

XX

CCHH(X)(X)

xx

=J=J

^

• For the i-th point pair, DLT minimizes For the i-th point pair, DLT minimizes ЄЄii ::

• In RIn R44, point pair is , point pair is XXii = [x y x’ y’] = [x y x’ y’]TT (assume w=w’=1)(assume w=w’=1)

• Augment Augment XXii with w’; then with w’; then RR44 quadrics are: quadrics are:

XXiiT T Q XQ Xii==ЄЄii or or = = ЄЄii

RR44 Quadrics for the Variety Quadrics for the Variety vvHH

00TT - -ww’’i i xxiiTT yy’’I I xxii

TT

ww’’i i xxiiTT 0 0TT - -xx’’i i xxii

TT

- -yy’’i i xxiiTT --xx’’i i xxii

TT 0 0T T

hh11

hh22

hh33

==

xxyyx’x’y’y’w’w’

x y x’ y’ w’x y x’ y’ w’

QQ

AAiih= h= ЄЄii

ЄЄi1i1

ЄЄi2i2

ЄЄi3i3

• For the i-th point pair, DLT minimizes For the i-th point pair, DLT minimizes ЄЄii ::

• Write each row as an RWrite each row as an R44 quadric: quadric: XXiiT T QQii XXii==ЄЄii

RR44 Quadrics for the Variety Quadrics for the Variety vvHH

00TT - -ww’’i i xxiiTT yy’’I I xxii

TT

ww’’i i xxiiTT 0 0TT - -xx’’i i xxii

TT

- -yy’’i i xxiiTT --xx’’i i xxii

TT 0 0T T

hh11

hh22

hh33

==AAii

h= h= ЄЄiiЄЄi1i1

ЄЄi2i2

ЄЄi3i3

Row 1Row 1Row 2Row 2Row 3Row 3

0 0 0 h0 0 0 h3131 -w’h -w’h2121

0 0 0 h0 0 0 h3232 -w’h -w’h2222

0 0 0 0 00 0 0 0 00 0 0 00 0 0 0 whwh2222

0 0 0 00 0 0 0 w’wh w’wh3333

0 0 -h0 0 -h31 31 0 w’h0 w’h1111

0 0 -h0 0 -h32 32 0 w’h0 w’h1212

0 0 0 0 0 0 0 -w h0 -w h3333

0 0 00 0 0 0 0 0 0

0 0 00 0 0 0 0 w’whw’wh1313

0 0 h0 0 h21 21 -h-h1111 0 0

0 0 h0 0 h22 22 -h-h12 12 0 0

0 0 0 0 0 0 0 w h0 w h2323

0 0 00 0 0 0 w h 0 w h1313

0 0 00 0 0 0 0 0 0

QQi1i1 for Row 1for Row 1 QQi2i2 for Row 2for Row 2 QQi3i3 for Row 3 for Row 3

• Write each row as an RWrite each row as an R44 quadric: quadric: XXT T QQii X=0 X=0

• ALL have this form: ALL have this form: QQii = =

• Quadric’s derivatives are easy:Quadric’s derivatives are easy:

RR44 Quadrics for the Variety Quadrics for the Variety vvHH

(Can also write as symmetric(Can also write as symmetricwithout changing meaning!)without changing meaning!)

0 00 0 a b c a b c0 00 0 d e f d e f0 0 0 00 0 0 0 g g0 0 0 00 0 0 0 h h0 0 0 00 0 0 0 j j

0 00 0 00 00 000 00 0 00 00 000 0 0 00 0 0 0 a a0 0 0 00 0 0 0 b b0 0 0 00 0 0 0 c c

QQii

xx::

0 00 0 00 00 000 00 0 00 00 000 0 0 00 0 0 0 d d0 0 0 00 0 0 0 e e0 0 0 00 0 0 0 f f

0 00 0 00 00 a a0 00 0 00 00 d d0 0 0 00 0 0 0 000 0 0 00 0 0 0 000 0 0 00 0 0 0 g g

0 00 0 00 00 b b0 00 0 00 00 e e0 0 0 00 0 0 0 000 0 0 00 0 0 0 000 0 0 00 0 0 0 h h

QQii

yy:: QQii

x’x’:: QQii

y’y’::

xxyyx’x’y’y’11

xxyyx’x’y’y’11

x y x’ y’ 1x y x’ y’ 1 x y x’ y’ 1x y x’ y’ 1 x y x’ y’ 1x y x’ y’ 1 x y x’ y’ 1x y x’ y’ 1

Sampson Error Approx.Sampson Error Approx.

• Sampson error’s Sampson error’s estimateestimate: : XXii = X = Xii + + XX

• Re-name DLT resultRe-name DLT result A Aiihh = = ЄЄi i asas CCHH(X) = (X) = ЄЄii = =

• Find Find xx: solve : solve ЄЄii + + XX == 0 0

• Or as in Book: Or as in Book: ЄЄii + + JJ XX == 0 0

+ + == 0 0

ЄЄi1i1

ЄЄi2i2

ЄЄi3i3

CCHH(X(Xii))

XX

^

ЄЄi1i1

ЄЄi2i2

ЄЄi3i3

CCHH(X)(X)

xx

ЄЄii

XXiiXX

xx

yy

x’x’

y’y’

CCH1H1(X(Xii) ) CCH1H1(X(Xii) ) CCH1H1(X(Xii) ) CCH1H1(X(Xii))

x x y y x’ x’ y’y’

CCH2H2(X(Xii) ) CCH2H2(X(Xii) ) CCH2H2(X(Xii) ) CCH2H2(X(Xii))

x x y y x’ x’ y’y’

CCH2H2(X(Xii) ) CCH2H2(X(Xii) ) CCH2H2(X(Xii) ) CCH2H2(X(Xii))

x x y y x’ x’ y’y’

(pg. 82)(pg. 82)

Find J terms Find J terms from Rfrom R44 quadrics, quadrics,

solve for solve for XX … …

Sampson Error Approx.Sampson Error Approx.

• Sampson error’s Sampson error’s estimateestimate: : XXii = X = Xii + + XX

• Re-name DLT resultRe-name DLT result A Aiihh = = ЄЄi i asas CCHH(X) = (X) = ЄЄii = =

• Find Find xx: solve : solve ЄЄii + + xx == 0 0

• Or as in Book: Or as in Book: ЄЄii + + JJ xx == 0 0

+ + == 0 0

ЄЄi1i1

ЄЄi2i2

ЄЄi3i3

CCHH(X(Xii))

XX

^

ЄЄi1i1

ЄЄi2i2

ЄЄi3i3

CCHH(X)(X)

xx

ЄЄii

XXiiXX

xx

yy

x’x’

y’y’

CCH1H1(X(Xii) ) CCH1H1(X(Xii) ) CCH1H1(X(Xii) ) CCH1H1(X(Xii))

x x y y x’ x’ y’y’

CCH2H2(X(Xii) ) CCH2H2(X(Xii) ) CCH2H2(X(Xii) ) CCH2H2(X(Xii))

x x y y x’ x’ y’y’

CCH2H2(X(Xii) ) CCH2H2(X(Xii) ) CCH2H2(X(Xii) ) CCH2H2(X(Xii))

x x y y x’ x’ y’y’

(pg. 82)(pg. 82)

!TROUBLE!!TROUBLE!rank=2, butrank=2, but

4 unknowns! 4 unknowns!

Sampson Error Approx.Sampson Error Approx.

• Sampson error’s Sampson error’s estimateestimate: : XXii = X = Xii + + XX

• Re-name DLT resultRe-name DLT result A Aiihh = = ЄЄi i asas CCHH(X) = (X) = ЄЄii = =

Or as in Book: Or as in Book: ЄЄii + + JJ xx == 0 0

+ + == 0 0

• ANSWER:ANSWER:

XX = -J = -JTT(JJ(JJTT))-1-1ЄЄ

ЄЄi1i1

ЄЄi2i2

ЄЄi3i3

^

ЄЄi1i1

ЄЄi2i2

ЄЄi3i3

CCHH(X)(X)

xx

ЄЄii

XXiiXX

xx

yy

x’x’

y’y’

CCH1H1(X(Xii) ) CCH1H1(X(Xii) ) CCH1H1(X(Xii) ) CCH1H1(X(Xii))

x x y y x’ x’ y’y’

CCH2H2(X(Xii) ) CCH2H2(X(Xii) ) CCH2H2(X(Xii) ) CCH2H2(X(Xii))

x x y y x’ x’ y’y’

CCH2H2(X(Xii) ) CCH2H2(X(Xii) ) CCH2H2(X(Xii) ) CCH2H2(X(Xii))

x x y y x’ x’ y’y’Answer: find Answer: find shortestshortest XX::

minimize minimize ||||XX||||22 by by

Lagrange multipliers…Lagrange multipliers…

How to use it:How to use it:

• Initialize: use DLT to find H from point pairsInitialize: use DLT to find H from point pairs

• Revise: estimates by Sampson: Revise: estimates by Sampson: XXii = X = Xii + + XX

• Adjust: find new H from estimates (DLT)Adjust: find new H from estimates (DLT)

• Repeat until Repeat until ||||XX||||2 2 is small enough. is small enough.

Refinements: apply fraction of Refinements: apply fraction of X X on each on each

iteration, so that H can change more...iteration, so that H can change more...

^

^

ENDEND

Aside: Lagrange MultipliersAside: Lagrange Multipliers

““Given only Given only f(x) = 0f(x) = 0, find shortest-length , find shortest-length xx””

Semi-magical vector trick:Semi-magical vector trick:– LengthLength22 is scalar value: is scalar value: ||x||||x||22 = x = xTTxx– Mix in an unknown vector Mix in an unknown vector (‘Lagrange multiplier’):(‘Lagrange multiplier’):

xxTTx - 2 x - 2 T T f(x) = f(x) = g(x,g(x,)) = = weird_lengthweird_length22

Aside: Lagrange MultipliersAside: Lagrange Multipliers

““Given only Given only f(x) = 0f(x) = 0, find shortest-length , find shortest-length xx””

Semi-magical vector trick:Semi-magical vector trick:– LengthLength22 is scalar value: is scalar value: ||x||||x||22 = x = xTTxx– Mix in an unknown vector Mix in an unknown vector (‘Lagrange multiplier’):(‘Lagrange multiplier’):

xxTTx - 2 x - 2 T T f(x) = f(x) = g(x,g(x,)) = = weird_lengthweird_length22 (MUST be = 0)(MUST be = 0)LengthLength22

Aside: Lagrange MultipliersAside: Lagrange Multipliers

““Given only Given only f(x) = 0f(x) = 0, find shortest-length , find shortest-length xx””

Semi-magical vector trick:Semi-magical vector trick:– LengthLength22 is scalar value: is scalar value: ||x||||x||22 = x = xTTxx– Mix in an unknown vector Mix in an unknown vector (‘Lagrange multiplier’):(‘Lagrange multiplier’):

xxTTx - 2 x - 2 T T f(x) = f(x) = g(x,g(x,)) = = weird_lengthweird_length22

Find shortest ‘Find shortest ‘weird_lengthweird_length22’:’:– Find Find ((g / g / x)x) = 0= 0, Find , Find ((g / g / ) = 0,) = 0,– Solve them for Solve them for (substitutions) (substitutions) – then use then use in in g(x, g(x,) ) to findto find x x !Done! !Done!

(MUST be = 0)(MUST be = 0)LengthLength22

More General Approach:More General Approach:

• Define ‘Measurement space’Define ‘Measurement space’ (e.g. (e.g. RR44))

– Vector: a Vector: a completecomplete measurement set measurement set – Vector holds only Vector holds only knownknown values, but values, but– Can be Can be ANYTHINGANYTHING: input,output, length, H, …: input,output, length, H, …– All possible measures (good or bad)All possible measures (good or bad)

• Define ‘Model’ Define ‘Model’ – All possible error-free ‘All possible error-free ‘perfect measurementsperfect measurements’’

such as the variety such as the variety vvHH

– Defined by a known Defined by a known functionfunction (e.g. (e.g. CCHH(X)(X) = 0 = 0 ) )

– A A subsetsubset of measurement space of measurement space

More General Approach:More General Approach:

• Gather points Gather points XXii in ‘measurement space’ in ‘measurement space’

• Replace Replace XXi i with ‘with ‘estimatesestimates’ ’ XXi i that:that:

– Satisfy the model, and Satisfy the model, and

– minimize distance || minimize distance || XXii – – XXii || ||

• Book Book (pg 85)(pg 85) gives examples for: gives examples for:– Error in both images (what we just did)Error in both images (what we just did)– Error in one image onlyError in one image only– Maximum likelihood estimation:Maximum likelihood estimation:

same as minimizing geometric error same as minimizing geometric error same as minimizing reprojection error same as minimizing reprojection error

^

^

DLT Non-InvarianceDLT Non-Invariance

!Accuracy depends on origin location!!Accuracy depends on origin location!

• ‘‘Non-optional’ Correction required:Non-optional’ Correction required:– Find centroid of measured pointsFind centroid of measured points– Find average distance of points to centroidFind average distance of points to centroid– Offset origin to centroid for all pointsOffset origin to centroid for all points– Scale about new origin to set Scale about new origin to set

average distance-to-origin to sqrt(2)average distance-to-origin to sqrt(2)– Reverse process after DLT. See book for proof.Reverse process after DLT. See book for proof.

xx

yy

yy

xx

(Outline on pg. 92)(Outline on pg. 92)