example: least square line fitting data scatterdata as 2d vectors x y a a x i +b y i = c a. x = c =...

20
Example: Least Square Line Fitting -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 0 1 2 3 4 5 6 7 8 9 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 0 1 2 3 4 5 6 7 8 9 Data scatter Data as 2D vectors x y a a x i +b y i = c a . x = c = ||x||| cos ø ø

Post on 21-Dec-2015

219 views

Category:

Documents


0 download

TRANSCRIPT

Example: Least Square Line Fitting

-2 -1.5 -1 -0.5 0 0.5 1 1.5 20

1

2

3

4

5

6

7

8

9

-2 -1.5 -1 -0.5 0 0.5 1 1.5 20

1

2

3

4

5

6

7

8

9

Data scatter Data as 2D vectors

x

y

a

a xi +b yi = c

a.x = c = ||x||| cos ø

ø

Introducing Homogenous Coordinates

-4-2

02

4 -5

0

5

10

-0.5

0

0.5

1

1.5

Data as 3D homogenous vectors pi = [xi yi 1]’

In 3D, the set of points liesClose to a common plane

a xi +b yi = c

a.x = c = ||x||| cos ø

Becomesa xi +b yi + c 1 = 0a.pi = 0

Geometry of solution

-50

50

510

-5

-4

-3

-2

-1

0

1

2

3

4

5

-5

0

5

0

5

10-5

0

5

-1

-0.5

0

0.5

1

-1

-0.5

0

0.5

1

0

0.5

1

1.5

2

-0.5 -0.5 0.5 0.50.25 -0.25 -0.25 0.25 2 2 2 2

A =

[U,S,V] = svd(A)

U = 0 1 0 0 0 1 1 0 0

S =4 0 0 00 1 0 00 0 0.5 0

Fundamental Matrix, why are 8 point matches enough?

u'

v '

1

⎢ ⎢ ⎢

⎥ ⎥ ⎥=

f11 f12 f13

f21 f22 f23

f31 f32 f33

⎢ ⎢ ⎢

⎥ ⎥ ⎥

u

v

1

⎢ ⎢ ⎢

⎥ ⎥ ⎥⇒ f33 =1

Thus only 8 free parameters => Need 8 or more constraints.

Stereo Reconstruction Ambiguity

Extrinsic Parameter ambiguity

Projective structure

Metric Structure

-1

-0.5

0

0.5

1

-1

-0.5

0

0.5

1

0

0.5

1

1.5

2

B = 1 -0.5 -0.5 0 0.86603 -0.86603 2 2 2

-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1

-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

U = 0 -1 0 0 0 -1 1 0 0

[V,D]=eig(B)Yields z-axis andComplex eigenvaluesRepresenting the ambiguity

[U,S,V] = svd(B)

Matlab examples

Select polygon

Choose a point in this view

1

2

34

5

67

89 10

11

1

2

3

1110 9

1 3

1110 9

1

1110

1

2

5

14

5

1

98

114

8

4

6

8

50 100 150 200 250 300 350 400 450 500

0

50

100

150

200

250

300

350

Selected point highlighted in red

1

2

34

5

67

89 10

11

50 100 150 200 250 300 350 400 450 500

0

50

100

150

200

250

300

350

1

2

3 4

5

6 7

8 9 10

11

50 100 150 200 250 300 350 400 450 500

0

50

100

150

200

250

300

350

Select polygon

Choose a point in this view

1

2

34

5

67

89 10

11

1

2

3

1110 9

1 3

1110 9

1

1110

1

2

5

14

5

1

98

114

8

4

6

8

50 100 150 200 250 300 350 400 450 500

0

50

100

150

200

250

300

350

Selected point highlighted in red

1

2

34

5

67

89 10

11

50 100 150 200 250 300 350 400 450 500

0

50

100

150

200

250

300

350

Homework #2 solns

Problem #2 Projected image of a cube

-0.08 -0.06 -0.04 -0.02 0 0.02 0.04 0.060.06

0.08

0.1

0.12

0.14

0.16

0.18

Problem #3

% 3) Show that a straight line in 3D projects to a straight line % in an image, using the simplest projection model, u = f x/z, v = f y/z.% Hint: A straight line can be defined by two points L = a*p1+(1-a)*p2),% where a is a scalar. % p1 = [x1,y1,z1]';% Show that a third point on the line p3 = a*p1+(1-a)*p2% projects to an image point (u3,v3) that can be written in the form% u3 = b u1 + (1-b) u2% v3 = b v1 + (1-b) v2% where b = a*z1/(a z1 + (1-a) z2)

p1 = 1/z1 M x1 p2 = 1/z2 M x2

x3 = a x1 +(1-a) x2

p3 = 1/z3 M x3 = a 1/z3 M x1 + (1-a) 1/z3 M x2 = a 1/z3 (z1/z1) M x1 + (1-a) 1/z3 (z2/z2) M x2 = a z1/z3 p1 + (1-a) z2/z3 p2

But now x3 = a x1 +(1-a) x2And z3 = a z1 +(1-a) z2Thusp3 = a z1/(a z1 +(1-a) z2) p1 + (1-a) z2/(a z1 +(1-a) z2) p2

Set b = a z1/(a z1 +(1-a) z2)Then 1-b = (1-a) z2/(a z1 +(1-a) z2)

And we have:

p3 = b p1 + (1-b) p2 {QED}