• Keine Ergebnisse gefunden

Algorithms and Applications:

N/A
N/A
Protected

Academic year: 2022

Aktie "Algorithms and Applications:"

Copied!
60
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Computer Vision I -

Algorithms and Applications:

Two-View Geometry

Carsten Rother

03/12/2013

(2)

This is the lecture with most math

… for any error on slides please contact:

(3)

v

Roadmap: matching 2 Images (appearance & geometry)

β€’ Find interest points (including different scales)

β€’ Find orientated patches around interest points to capture appearance

β€’ Encode patch in a descriptor

β€’ Find matching patches according to appearance (similar descriptors)

β€’ Verify matching patches according to geometry

(4)

The tasks for this lecture

β€’ Two-view transformations we look at today:

β€’ Homography 𝐻: between two views

β€’ Camera matrix 𝑃 (mapping from 3D to 2D)

β€’ Fundamental matrix 𝐹 between two un-calibrated views

β€’ Essential matrix 𝐸 between two calibrated views

β€’ Derive geometrically: 𝐻, 𝑃, 𝐹, 𝐸 , i.e. what do they mean?

β€’ Calibration: Take primitives (points, lines, planes, cones,…) to compute 𝐻, 𝑃, 𝐹, 𝐸 :

β€’ What is the minimal number of points to compute them (very important for next lecture on robust methods)

β€’ If we have many points with noise: what is the best way to computer them: algebraic error versus geometric error ?

β€’ Can we derive the intrinsic (𝐾) an extrinsic (𝑅, 𝑇) parameters from 𝐻, 𝑃, 𝐹, 𝐸?

β€’ What can we do with 𝐻, 𝑃, 𝐹, 𝐸? (e.g. augmented reality)

(5)

Singular Value Decomposition (SVD)

β€’ Reminder: separable filters

Apply SVD to the kernel matrix:

Note:

β„Ž π‘₯ βˆ— β„Ž 𝑦

β„Ž π‘₯ β„Ž 𝑦 β„Ž π‘₯

β„Ž 𝑦

(6)

Properties of SVD

β€’ In short: 𝐴 = π‘ˆπ·π‘‰

𝑇

β€’ If 𝐴 = π‘š Γ— 𝑛 with π‘š β‰₯ 𝑛 then π‘ˆ = π‘š Γ— 𝑛 , D = n Γ— 𝑛, 𝑉 = 𝑛 Γ— 𝑛

β€’ If 𝐴 = π‘š Γ— 𝑛 with π‘š < 𝑛 then add zero-valued rows to A to make it 𝑛 Γ— 𝑛

β€’ π‘ˆ and 𝑉 form an orthogonal basis: π‘ˆ

𝑇

π‘ˆ = 𝑉

𝑇

𝑉 = 𝐼

𝑛×𝑛

β€’ It is: π‘ˆπ‘₯ = π‘₯ (an example U is a rotation matrix)

β€’ Implementation: 𝐴 = π‘š Γ— 𝑛 needs: 4π‘š

2

𝑛 + 8π‘šπ‘›

2

+ 9𝑛

3

[Golub-89]

β€’ It is: 𝐴

𝑇

𝐴 = π‘‰π·π‘ˆ

𝑇

π‘ˆπ·π‘‰

𝑇

= 𝑉𝐷

2

𝑉

𝑇

then the entries of 𝐷

2

are eigenvalues of 𝐴

𝑇

𝐴 and eigenvectors are columns of 𝑉

Singular values; sorted: 𝜎

𝑖

β‰₯ 𝜎

𝑖+1

(7)

Null space (correction from last lecture)

β€’ Right null space: 𝐴 𝒙 = 𝟎 where 𝐴 = π‘š Γ— 𝑛 with π‘š < 𝑛 this is given by the (n-m) last column vectors in 𝑉

β€’ Example:

A =

1 2

βˆ’1 2

βˆ’1 2

βˆ’1 2

1 2

1 2

Then SVD is:

1 2

βˆ’1

√2

βˆ’1

βˆ’1 2 2

1

√2 1

0 0 02

=

1

√2

βˆ’1

√2 0

βˆ’1

√2 1

√2 0 0 0 1

1 0 0 0 1 0 0 0 0

1

√2 0 βˆ’1√2 0 1 0

βˆ’1

√2 0 βˆ’1√2

1

√2 0 βˆ’1 0 1 √20 0 0 0

𝒙 = πœ†

βˆ’1

√2 0

βˆ’1

√2

= πœ† 1 0 1

Nullspace

and 𝐴π‘₯ = 0

(8)

Least Square Problem (homogenous linear system)

β€’ Find a solution to 𝐴𝒙 = 0 where 𝐴 = π‘š Γ— 𝑛 with π‘š β‰₯ 𝑛

β€’ Solution 𝒙 = 0 is not interesting

β€’ If 𝒙 is solution then any π‘˜π’™. So we look for 𝒙 = 1

β€’ 𝐴𝒙 = 0 is never exactly zero (due to noise in measurements).

Hence, solve in least square sense:

𝒙 βˆ— = π‘Žπ‘Ÿπ‘”π‘šπ‘–π‘› 𝒙 𝐴𝒙 subject to 𝒙 = 𝟏

β€’ 𝒙 βˆ— is the last column of 𝑉, where 𝐴 = π‘ˆπ·π‘‰ 𝑇

(9)

(blackboard)

Proof

(10)

Topic 1: Homography 𝐻

β€’ Derive geometrically 𝐻

β€’ Calibration: Take measurements (points) to compute 𝐻

β€’ How do we do that with a minimal number of points?

β€’ How do we do that with many points?

β€’ Can we derive the intrinsic (𝐾) an extrinsic (𝑅, 𝑇) parameters from 𝐻?

β€’ What can we do with 𝐻 ?

(11)

Definition Homography

β€’ Definition: A projectivity (or homography) β„Ž is an invertible mapping β„Ž from 𝑃

2

to 𝑃

2

such that three points π‘₯

1

, π‘₯

2

, π‘₯

3

lie on the same line if an only if β„Ž(π‘₯

1

), β„Ž(π‘₯

2

), β„Ž(π‘₯

3

) do.

β€’ Theorem: A mapping β„Ž from 𝑃

2

to 𝑃

2

is a homography if and only if there exists a non-singular 3 Γ— 3 matrix H with β„Ž(π‘₯) = 𝐻π‘₯

β€’ In equations: xβ€² = 𝐻π‘₯

β€’ 𝐻 has 8 DoF

π‘₯ 𝑦 1

Transformation matrix 𝐻 β„Ž

11

β„Ž

12

β„Ž

13

β„Ž

21

β„Ž

22

β„Ž

23

β„Ž

31

β„Ž

32

β„Ž

33

𝑦′π‘₯β€²

1

=

(12)

Definition Homography

β€’ Definition: A projectivity (or homography) β„Ž is an invertible mapping β„Ž from 𝑃

2

to 𝑃

2

such that three points π‘₯

1

, π‘₯

2

, π‘₯

3

lie on the same line if an only if β„Ž(π‘₯

1

), β„Ž(π‘₯

2

), β„Ž(π‘₯

3

) do.

β€’ Theorem: A mapping β„Ž from 𝑃

2

to 𝑃

2

is a homography if and only if there exists a non- singular 3 Γ— 3 matrix H with β„Ž π‘₯ = 𝐻π‘₯

One direction of proof:

β€’ If π‘₯

1

, π‘₯

2

, π‘₯

3

lie on a line 𝑙 then 𝑙

𝑇

π‘₯

𝑖

= 0.

β€’ Let H be a non-singular 3 Γ— 3 matrix. Then 𝑙

𝑇

𝐻

βˆ’1

𝐻π‘₯

𝑖

= 0. Hence the points: 𝐻π‘₯

𝑖

lie

on a transformed line 𝑙

β€²

= 𝑙

𝑇

𝐻

βˆ’1

(13)

Geometric Derivation: Homography

π‘₯ 𝑦 1

Transformation matrix 𝐻 β„Ž

11

β„Ž

12

β„Ž

13

β„Ž

21

β„Ž

22

β„Ž

23

β„Ž

31

β„Ž

32

β„Ž

33

π‘₯′𝑦′

1

=

Mapping via a plane

(14)

Notation: x (homogenous 2D), x (inhomogenous 2D), 𝑿 (homogenous 3D), 𝑿(inhomogenous 3D)

Homography from a rotating camera

Put it toghter: 𝒙

𝟏

= 𝑲

𝟏

𝑹𝑲

πŸŽβˆ’πŸ

𝒙

𝟎

Hence 𝑯 = 𝑲

𝟏

𝑹𝑲

πŸŽβˆ’πŸ

is a homography (general 3x3 matrix) with 8 DoF

~

𝑲 = 𝑓 0 π‘šπ‘“ 𝑝 𝑠 𝑝

𝑦π‘₯

0 0 1

𝒙 = 𝑲 𝑹 (𝑰

πŸ‘Γ—πŸ‘

| βˆ’ π‘ͺ) 𝑿

Camera 0: 𝒙

𝟎

= 𝑲

𝟎

𝑿 (in 3D ∢ 𝑲

πŸŽβˆ’πŸ

𝒙

𝟎

= 𝑿) Camera 1: 𝒙

𝟏

= 𝑲

𝟏

𝑹 𝑿

~

~

~

~

~

(15)

Homography of a projection via a plane

(See geometric derivation on page 49)

Definition: A projectivity (or homography) β„Ž is an invertible mapping β„Ž from 𝑃

2

to 𝑃

2

such that three points π‘₯

1

, π‘₯

2

, π‘₯

3

lie on the same line if an only if β„Ž(π‘₯

1

), β„Ž(π‘₯

2

), β„Ž(π‘₯

3

) do so.

We know (see Theorem): All Homographies can be written as β„Ž(π‘₯) = 𝐻π‘₯

We see visually that lines map to lines

So we can write: π‘₯

2

= 𝐻π‘₯

1

(16)

How to compute/calibrate 𝐻

β€’ We have πœ†π‘₯β€² = 𝐻π‘₯

β€’ H has 8 DoF

β€’ We get for each pair of matching points (π‘₯β€², π‘₯) the 3 equations:

1) β„Ž

11

π‘₯

1

+ β„Ž

12

π‘₯

2

+ β„Ž

13

π‘₯

3

= πœ†π‘₯

1β€²

2) β„Ž

21

π‘₯

1

+ β„Ž

22

π‘₯

2

+ β„Ž

23

π‘₯

3

= πœ†π‘₯

2β€²

β€’ This gives 2 linear independent equations be taking the ratios.

Here 1) divide by 2) gives:

3) β„Ž

31

π‘₯

1

+ β„Ž

32

π‘₯

2

+ β„Ž

33

π‘₯

3

= πœ†π‘₯

3

β€²

π‘₯

1

π‘₯

2β€²

, π‘₯

2

π‘₯

2β€²

, π‘₯

3

π‘₯

2β€²

, βˆ’π‘₯

1

π‘₯

1β€²

, βˆ’π‘₯

2

π‘₯

1β€²

, βˆ’π‘₯

3

π‘₯

1β€²

β„Ž

11

, β„Ž

12

, β„Ž

13

, β„Ž

21

, β„Ž

22

, β„Ž

23 𝑇

= 0

(17)

How to compute/calibrate 𝐻

β„Ž

11

β„Ž

12

β„Ž

13

β„Ž

21

β„Ž

22

β„Ž

23

β„Ž

31

β„Ž

32

β„Ž

33

= 0

β€’ Put it together:

β€’ We need a minimum of 4 points to get π΄β„Ž = 0 with 𝐴 𝑖𝑠 8 Γ— 9 matrix, and β„Ž 𝑖𝑠 9 Γ— 1 vector

β€’ Solution for β„Ž is the right null space of 𝐴 (This solution will be useful in next lecture)

π‘₯

1

π‘₯

2β€²

π‘₯

2

π‘₯

2β€²

π‘₯

3

π‘₯

2β€²

βˆ’π‘₯

1

π‘₯

1β€²

βˆ’π‘₯

2

π‘₯

1β€²

βˆ’π‘₯

3

π‘₯

1β€²

0 0 0 0 0 0 π‘₯

1

π‘₯

3β€²

π‘₯

2

π‘₯

3β€²

π‘₯

3

π‘₯

3β€²

βˆ’π‘₯

1

π‘₯

2β€²

βˆ’π‘₯

2

π‘₯

2β€²

βˆ’π‘₯

3

π‘₯

2β€²

.

. .

(18)

Often we have many, slightly wrong point-matches

image

Algorithm:

1) Take π‘š β‰₯ 4 point matches (π‘₯, π‘₯’) 2) Assemble A with Ah = 0

3) compute 𝒉 βˆ— = π‘Žπ‘Ÿπ‘”π‘šπ‘–π‘› β„Ž 𝐴𝒉 subject to 𝒉 = 𝟏, use SVD to do this.

We know how to do: 𝒙 βˆ— = π‘Žπ‘Ÿπ‘”π‘šπ‘–π‘› 𝒙 𝐴𝒙 subject to 𝒙 = 𝟏

(19)

A more numerically stable solution

β€’ Coefficients of an equation system should be in the same order of magnitude so as not to lose significant digits

β€’ In pixels: π‘₯

π‘Ž

π‘₯

𝑏

’ ~ 1𝑒6

β€’ Conditioning: scale and shift points to be in [-1..1] (or +/- √2 )

β€’ A general rule, not only for homography computation

β€’ How to do it:

(20)

A more numerically stable solution

Algorithm:

1) Take π‘š β‰₯ 4 point matches (π‘₯, π‘₯’)

2) Compute T, and condition points: π‘₯ = 𝑇π‘₯; π‘₯’ = 𝑇’π‘₯’

3) Assemble A with Ah = 0

4) compute 𝒉

βˆ—

= π‘Žπ‘Ÿπ‘”π‘šπ‘–π‘›

β„Ž

𝐴𝒉 subject to 𝒉 = 𝟏, use SVD to do this.

4) Get H of unconditioned points: 𝑇

β€²βˆ’1

𝐻𝑇 (Note: 𝑇

β€²

π‘₯

β€²

= 𝐻𝑇π‘₯)

(21)

Motivation for next lecture

Question 1: If a match is completly wrong then is a bad idea

Question 2: If a match is slighly wrong then might not be perfect.

Better might be a geometric error:

π‘Žπ‘Ÿπ‘”π‘šπ‘–π‘›

β„Ž

𝐴𝒉 π‘Žπ‘Ÿπ‘”π‘šπ‘–π‘›

β„Ž

𝐴𝒉

π‘Žπ‘Ÿπ‘”π‘šπ‘–π‘›

β„Ž

𝑯π‘₯ βˆ’ π‘₯β€²

(22)

Can we get 𝐾’𝑠 and 𝑅 from 𝐻 ?

β€’ Assume we have 𝐻 = 𝐾 1 𝑅𝐾 0 βˆ’1 of a rotating camera, can we get out 𝐾 1 , 𝑅, 𝐾 0 ?

β€’ 𝐻 has 8 DoF

β€’ 𝐾 1 , 𝑅, 𝐾 0 have together 13 DoF

β€’ Not directly possible, only with assumptions on K.

(No application needs such a decomposition)

β€’ For other transfromations such decompositions are possible

(23)

What can we do with 𝐻 ?

β€’ Panoramic stitching with rotating camera (exercise later)

Warp images into a canonical view: π‘₯β€² = 𝐻π‘₯

(24)

What can we do with 𝐻 ?

(25)

What can we do with 𝐻 ?

β€’ Plane-based augmented realty

(26)

Homography 𝐻 : Summary

β€’ Derive geometrically 𝐻

β€’ Calibration: Take measurements (points) to compute 𝐻

β€’ Minimum of 4 points. Solution: right null space of π΄β„Ž = 0

β€’ Many points. Use SVD to solve 𝒉

βˆ—

= π‘Žπ‘Ÿπ‘”π‘šπ‘–π‘›

β„Ž

𝐴𝒉

β€’ Can we derive the intrinsic (𝐾) an extrinsic (𝑅, 𝑇) parameters from 𝐻?

-> hard. Not discussed much

β€’ What can we do with 𝐻 ?

-> augmented reality on planes, panoramic stitching

(27)

Topic 2: Camera Matrix P

β€’ Derive geometrically 𝑃

β€’ Calibration: Take measurements (points) to compute 𝑃

β€’ How do we do that with a minimal number of points?

β€’ How do we do that with many points?

β€’ Can we derive the intrinsic (𝐾) an extrinsic (𝑅, 𝑇) parameters from 𝑃?

β€’ What can we do with 𝑃?

(28)

Geometric Derivation: Camera Matrix (Reminder)

β€’ Camera matrix P has 11 DoF

β€’ Intrinsic parameters

β€’ Principal point coordinates (𝑝 π‘₯ , 𝑝 𝑦 )

β€’ Focal length 𝑓

β€’ Pixel magnification factors π‘š

β€’ Skew (non-rectangular pixels) 𝑠

β€’ Extrinsic parameters

β€’ Rotation 𝑹 (3DoF) and translation 𝐂 (3DoF) relative to world coordinate system

𝒙 = 𝑲 𝑹 (𝑰

πŸ‘Γ—πŸ‘

| βˆ’ π‘ͺ) 𝑿 ~

~

𝑲 =

𝑓 𝑠 𝑝

π‘₯

0 π‘šπ‘“ 𝑝

𝑦

0 0 1

𝒙 = 𝑷 𝑿

(29)

How can we compute/calibrate 𝑃 ?

𝒙 = 𝑲 𝑹 (𝑰

πŸ‘Γ—πŸ‘

| βˆ’ π‘ͺ) 𝑿 𝒙 = 𝑷 𝑿

Important move in all directions: π‘₯, 𝑦, 𝑧

Calibration pattern

(30)

How can we compute/calibrate 𝑃 ?

β€’ We have πœ†π‘₯β€² = 𝑃𝑋

β€’ 𝑃 has 11 DoF

β€’ We get for each point pair (π‘₯β€², 𝑋) 3 equations, but only 2 linear independent once, by taking ration (to get rid of πœ†)

β€’ We need a minimum of 6 Points to get 12 equations

Algorithm (DLT - Direct Linear Transform):

1) Take π‘š β‰₯ 6 points.

2) Condition points 𝑋, π‘₯β€² using 𝑇, 𝑇′

3) Assemble A with 𝐴𝑝 = 0 (𝐴 𝑖𝑠 π‘š Γ— 12 and 𝑝 is vectorized 𝑃) 4) compute 𝑝

βˆ—

= π‘Žπ‘Ÿπ‘”π‘šπ‘–π‘›

𝑝

𝐴𝑝 subject to 𝑝 = 1

use SVD to do this.

5) Get out unconditioned 𝑃 = 𝑇

β€²βˆ’1

𝑃𝑇 (note 𝑇’π‘₯’ = 𝑃 𝑇𝑋)

Note: a version with minimal number of points (6) is same as with many points

(31)

Half-way slide

3 minutes break. Stand Up. Please ask me Questions.

(32)

An alternative: Lagrange Multiplier

Maximize 𝑓 π‘₯, 𝑦 subject to 𝑔 π‘₯, 𝑦 = 𝑐

Lagrange function: 𝐿 π‘₯, 𝑦, πœ† = 𝑓 π‘₯, 𝑦 + πœ† (𝑔 π‘₯, 𝑦 βˆ’ 𝑐) An optimal solution is obtained for:

πœ•πΏ(π‘₯,𝑦,πœ†)

πœ•π‘₯

= 0 ;

πœ•πΏ(π‘₯,𝑦,πœ†)πœ•π‘¦

= 0 ;

πœ•πΏ(π‘₯,𝑦,πœ†)πœ•πœ†

= 0 (these are 3 constraints and 3 unknowns)

Note:

πœ•πΏ(π‘₯,𝑦,πœ†)πœ•πœ†

= 𝑔 π‘₯, 𝑦 βˆ’ 𝑐 = 0 (the original constraint)

(33)

An alternative: Lagrange Multiplier

β€’ Why does

πœ•πΏ(π‘₯,𝑦,πœ†)πœ•π‘₯

= 0 ;

πœ•πΏ(π‘₯,𝑦,πœ†)πœ•π‘¦

= 0 give an optimal solution for 𝑓

β€’ Lagrange function: 𝐿 π‘₯, 𝑦, πœ† = 𝑓 π‘₯, 𝑦 + πœ† (𝑔 π‘₯, 𝑦 βˆ’ 𝑐)

β€’ We have:

πœ•πΏ(π‘₯,𝑦,πœ†)

πœ•π‘₯

=

πœ•π‘“(π‘₯,𝑦)πœ•π‘₯

+ πœ†

πœ•π‘”(π‘₯,𝑦)

πœ•π‘₯

= 0

πœ•πΏ(π‘₯,𝑦,πœ†)

πœ•π‘¦

=

πœ•π‘“(π‘₯,𝑦)πœ•π‘¦

+ πœ†

πœ•π‘”(π‘₯,𝑦)πœ•π‘¦

= 0

β€’ This means that gradients are aligned (

πœ•π‘“(π‘₯,𝑦)πœ•π‘₯

,

πœ•π‘“(π‘₯,𝑦)

πœ•π‘¦

) = - πœ† (

πœ•π‘”(π‘₯,𝑦)πœ•π‘₯

,

πœ•π‘”(π‘₯,𝑦)

πœ•π‘¦

)

Gradient 𝑓 Gradient 𝑔

(34)

(blackboard)

Lagrange Multiplier: Example

This gives:

4πœ†12

+

4πœ†12

-1 = 0; hence: πœ† = +/βˆ’

12

Maximize 𝑓 π‘₯, 𝑦 = π‘₯ + 𝑦 subject to x

2

+ y

2

= 1

Lagrange function: 𝐿 π‘₯, 𝑦, πœ† = π‘₯ + 𝑦 + πœ† (π‘₯

2

+ 𝑦

2

βˆ’ 1)

πœ•πΏ(π‘₯,𝑦,πœ†)

πœ•π‘₯

= 1 + 2πœ†π‘₯ = 0 (gives: π‘₯ =

βˆ’12πœ†

)

πœ•πΏ(π‘₯,𝑦,πœ†)

πœ•π‘¦

= 1 + 2πœ†π‘¦ = 0 (gives: y =

βˆ’12πœ†

)

πœ•πΏ(π‘₯,𝑦,πœ†)

πœ•πœ†

= π‘₯

2

+ 𝑦

2

βˆ’ 1 = 0

Two Solutions:

βˆ’ 22

,

βˆ’ 22

,

22

,

22

We require:

(35)

How can we compute/calibrate 𝑃 ?

β€’ Goal: compute 𝑝

βˆ—

= π‘Žπ‘Ÿπ‘”π‘šπ‘–π‘›

𝑝

𝐴𝑝 subject to 𝑝 = 1

β€’ Let us rewrite 𝑝 = 1 as 1 βˆ’ 𝑝

𝑇

𝑝 = 0

β€’ We have to solve the following problem:

πœ•

πœ•π‘

𝑝

𝑇

𝐴

𝑇

𝐴𝑝 + πœ† 1 βˆ’ 𝑝

𝑇

𝑝 = 0 (note: 𝐴𝑝 = 𝑝

𝑇

𝐴

𝑇

𝐴𝑝)

β€’ This gives after some transformation: 𝐴

𝑇

𝐴𝑝 = πœ†π‘

β€’ The solutions for 𝑝 are the eigenvectors of 𝐴

𝑇

𝐴 and πœ† the corresponding eigenvalues

β€’ The least squared error is then:

π‘Žπ‘Ÿπ‘”π‘šπ‘–π‘›

𝑝

𝐴𝑝 = π‘Žπ‘Ÿπ‘”π‘šπ‘–π‘›

𝑝

𝑝

𝑇

𝐴

𝑇

𝐴𝑝 = π‘Žπ‘Ÿπ‘”π‘šπ‘–π‘›

𝑝

𝑝

𝑇

πœ†π‘

note 𝐴𝑇𝐴𝑝 = πœ†π‘

(36)

β€’ Assume 𝑃 is known, can we get out 𝐾, 𝑅, 𝐢 ?

β€’ P has 11 DoF

β€’ 𝐾, 𝑅, 𝐢 have together 5+3+3=11 DoF -> possible

β€’ How to do it:

1) The camera center 𝐢 is the right nullspace of P 𝑃𝐢 = 𝐾 𝑅 (𝐢 βˆ’ 𝐢) = 0

2) 𝑃 = [𝐾𝑅| βˆ’ 𝐾𝑅𝐢] ; 𝐴 = 𝐾𝑅

can be done with unique RQ decomposition, where R is upper- triangular matrix and Q a rotation matrix (see HZ page 579)

How can we get K,R,C from P

𝒙 = 𝑲 𝑹 (𝑰

πŸ‘Γ—πŸ‘

| βˆ’ π‘ͺ) 𝑿 ~ 𝒙 = 𝑷 𝑿

~

~

~

~

~

~

~

(37)

What can we do with 𝑃 ?

β€’ Many things can be done with an externally and internally calibrated camera

β€’ Robot navigation, augmented reality, photogrammetry …

camera

Manipulator

(38)

Camera Matrix 𝑃 : Summary

β€’ Derive geometrically 𝑃

β€’ Calibration: Take measurements (points) to compute 𝑃

β€’ 6 or more points. Use SVD to solve 𝒑

βˆ—

= π‘Žπ‘Ÿπ‘”π‘šπ‘–π‘›

β„Ž

𝐴𝒑

β€’ Can we derive the intrinsic (𝐾) an extrinsic (𝑅, 𝑇) parameters from 𝐻?

-> yes, use SVD and RQ decomposition

β€’ What can we do with 𝑃 ?

-> very many things (robotic, photogrammetry, augmented reality, …)

𝒙 = 𝑲 𝑹 (𝑰

πŸ‘Γ—πŸ‘

| βˆ’ π‘ͺ) 𝑿 ~

𝒙 = 𝑷 𝑿

(39)

Topic 3: Fundamental/Essential Matrix 𝐹/𝐸

β€’ Derive geometrically 𝐹/𝐸

β€’ Calibration: Take measurements (points) to compute 𝐹/𝐸

β€’ How do we do that with a minimal number of points?

β€’ How do we do that with many points?

β€’ Can we derive the intrinsic (𝐾) an extrinsic (𝑅, 𝑇) parameters from 𝐹/𝐸?

β€’ What can we do with 𝐹/𝐸?

(40)

Reminder from Lecture 4: The 3D case

Illustration of the general 3D case

Appearance based matching:

Geometry based matching:

1) Assume sensible camera model. We will see that: Given 7 matching

3D points defines how other 3D points match.

(41)

3D Geometry

Non-moving scene

𝑃’

Rigidly (6D) -moving scene

Both cases are equivalent for the following derivations

(42)

Epipolar Geometry

(43)

Epipolar Geometry

(44)

Epipolar Geometry

(45)

Epipolar Geometry

(46)

Epipolar Geometry

Epipolar plane: Plane through both camera centers and world point.

(47)

Epipolar Geometry

(48)

Epipolar Geometry

β€’ Epipolar lines:

β€’ Intersect at the epipoles

β€’ In general not parallel

(49)

Example: Converging Cameras

(50)

Example: Motion Parallel to Camera

β€’ We will use this idea when it comes to stereo matching (in 2 lectures)

(51)

Example: Forward Motion

β€’ Epipoles have same coordinate in both images

β€’ Points move along lines radiating from epipole

(52)

The maths behind it: Fundamental/Essential Matrix

The 3 vectors are in same plane (co-planar):

1) 𝑇 = 𝐢

1

βˆ’ 𝐢

0

2) 𝑋 βˆ’ 𝐢

0

3) 𝑋 βˆ’ 𝐢

1

Set camera matrix: π‘₯

0

= 𝐾

0

𝐼 0 𝑋 and π‘₯

1

= 𝐾

1

𝑅

βˆ’1

𝐼 βˆ’πΆ

1

𝑋 The three rays are:

1) T 2) 𝐾

0βˆ’1

π‘₯

0

3) 𝑅𝐾

1βˆ’1

π‘₯

1

+ 𝐢

1

βˆ’ 𝐢

1

= 𝑅𝐾

1βˆ’1

π‘₯

1

We know that:

𝐾

0βˆ’1

π‘₯

0 𝑇

𝑇

Γ—

𝑅(𝐾

1βˆ’1

π‘₯

1

) = 0 which gives: π‘₯

0𝑇

𝐾

0βˆ’π‘‡

𝑇

Γ—

𝑅(𝐾

1βˆ’1

π‘₯

1

) = 0

~ ~ ~

~ ~

~ ~

~

~

~ ~

~ ~

(53)

The maths behind it: Fundamental/Essential Matrix

β€’ In an un-calibrated setting (𝐾’𝑠 not known):

π‘₯ 0 𝑇 𝐾 0 βˆ’π‘‡ 𝑇 Γ— 𝑅(𝐾 1 βˆ’1 π‘₯ 1 ) = 0

β€’ In short: π‘₯ 0 𝑇 𝐹π‘₯ 1 = 0 where F is called the Fundamental Matrix

(discovered by Faugeras and Luong 1992, Hartley 1992)

β€’ In an calibrated setting ( 𝐾 ’s are known):

we use rays: π‘₯ 𝑖 = 𝐾 𝑖 βˆ’1 π‘₯ 𝑖

then we get: π‘₯ 0 𝑇 𝑇 Γ— 𝑅π‘₯ 1 = 0

In short: π‘₯ 0 𝑇 𝐸π‘₯ 1 = 0 where E is called the Essential Matrix

(discovered by Longuet-Higgins 1981)

~

~

(54)

Fundamental Matrix: Properties

β€’ We have π‘₯ 0 𝑇 𝐹π‘₯ 1 = 0 where F is called the Fundamental Matrix

β€’ It is det 𝐹 = 0. Hence F has 7 DoF Proof: 𝐹 = 𝐾 0 βˆ’π‘‡ 𝑇 Γ— 𝑅𝐾 1 βˆ’1

𝐹 has Rank 2 since 𝑇 Γ— has Rank 2

~

Check: det( π‘₯

Γ—

) = π‘₯

3

π‘₯

3

0 βˆ’ π‘₯

1

π‘₯

2

+ π‘₯

2

π‘₯

1

π‘₯

3

+ π‘₯

2

0 = 0

𝒙

Γ—

=

0 βˆ’π‘₯

3

π‘₯

2

π‘₯

3

0 βˆ’π‘₯

1

βˆ’π‘₯

2

π‘₯

1

0

~

(55)

Fundamental Matrix: Properties

β€’ For any two matching points (i.e. have the same 3D point) we have: π‘₯ 0 𝑇 𝐹π‘₯ 1 = 0

β€’ Compute epipolar line in camera 1 of a point π‘₯ 0 : 𝑙 1 𝑇 = π‘₯ 0 𝑇 𝐹 (since π‘₯ 0 𝑇 𝐹π‘₯ 1 = 𝑙 1 𝑇 π‘₯ 1 = 0)

β€’ Compute epipolar line in camera 1 of a point π‘₯ 0 :

𝑙 0 = 𝐹π‘₯ 1 (since π‘₯ 0 𝑇 𝐹π‘₯ 1 = π‘₯ 0 𝑇 𝑙 0 = 0)

(56)

𝑋

~

~

Fundamental Matrix: Properties

Camera 0

Camera 1

β€’ For any two matching points (i.e. have the same 3D point) we have: π‘₯ 0 𝑇 𝐹π‘₯ 1 = 0

β€’ Epipole 𝑒 0 is a projection of 𝐢 1 into camera 0.

It is: 𝑒 0 𝑇 𝐹π‘₯ 𝑖 = 0 for all points π‘₯ 𝑖 (since all lines 𝑙

0

= 𝐹π‘₯

1

go through 𝑒

0𝑇

)

This means: 𝑒 0 𝑇 𝐹 = 0

So 𝑒 0 is left nullspace of 𝐹 (can be computed with SVD)

β€’ Epipole 𝑒 1 is right null space of 𝐹 (𝐹𝑒 1 = 0)

(57)

How can we compute 𝐹 (2-view calibration) ?

β€’ Each pair of matching points gives one linear constraint π‘₯

𝑇

𝐹π‘₯

β€²

= 0 in 𝐹 . For π‘₯, π‘₯β€² we get:

β€’ Given π‘š β‰₯ 8 matching points (π‘₯

β€²

, π‘₯) we can compute the F in a simple way.

𝑓

11

𝑓

12

𝑓

13

𝑓

21

𝑓

22

𝑓

23

𝑓

31

𝑓

32

𝑓

33

π‘₯

1

π‘₯

1β€²

π‘₯

1

π‘₯

2β€²

π‘₯

1

π‘₯

3β€²

π‘₯

2

π‘₯

1β€²

π‘₯

2

π‘₯

2β€²

π‘₯

2

π‘₯

3β€²

π‘₯

3

π‘₯

1β€²

π‘₯

3

π‘₯

2β€²

π‘₯

3

π‘₯

3β€²

= 0

.

. .

(58)

How can we compute 𝐹 (2-view calibration) ?

Method (normalized 8-point algorithm):

1) Take π‘š β‰₯ 8 points

2) Compute T, and condition points: π‘₯ = 𝑇π‘₯; π‘₯’ = 𝑇’π‘₯’

3) Assemble 𝐴 with 𝐴𝑓 = 0, here A is of size π‘š Γ— 9, and 𝑓 vectorized 𝐹 4) Compute 𝑓

βˆ—

= π‘Žπ‘Ÿπ‘”π‘šπ‘–π‘›

𝑓

𝐴𝑓 subject to 𝑓 = 1

use SVD to do this.

5) Get 𝐹 of unconditioned points: 𝑇

𝑇

𝐹𝑇′ (note: (𝑇π‘₯)

𝑇

𝐹 𝑇′π‘₯

β€²

= 0)

4) Make π‘Ÿπ‘Žπ‘›π‘˜ 𝐹 = 2

(59)

How to make 𝐹 Rank 2

β€’ (Again) use SVD:

Set last singular value 𝜎

π‘βˆ’1

to 0 then A has Rank 𝑝 βˆ’ 1 and not p (assume A had full Rank p before)

Proof: diagonal matrix has Rank 𝑝 βˆ’ 1 hence A has Rank 𝑝 βˆ’ 1

(60)

Can we compute 𝐹 with just 7 points?

Method (7-point algorithm):

1) Take π‘š = 7 points.

2) Assemble 𝐴 with 𝐴𝑓 = 0, here A is of size 7 Γ— 9, and 𝑓 vectorized 𝐹 3) Compute 2D right null space: 𝛼𝐹

1

+ 1 βˆ’ 𝛼 𝐹

2

(use SVD to do this) 4) Derive cubic polynomial equation: det(𝛼𝐹

1

+ 1 βˆ’ 𝛼 𝐹

2

) = 0.

This gives one or three real solutions.

Note an 8

th

point would say which of these 3 solutions is the correct one.

We will see in next lecture that 7-point algorithm is the best choice for robust case

Referenzen

Γ„HNLICHE DOKUMENTE

– Encryption, Hash Function, Digital Signature, Kerberos, PGP. β€’ Security is only a

β€’ Undirected graphical model (also called Markov Random Field).. β€’ Factor graphs (which we will

Generative Models are used successfully when

We want to classify the white pixel Feature: color of the green pixel Parameters: 2D offset vector. 1-dimensional: We want to classify the

β€’ Image categorization: Generative versus Discriminative Approach (finalize from last lecture).. β€’

Our new algorithm uses binary search on hash tables organized by prefix lengths and scales very well as address and routing table sizes increase: independent of the table size, it

We then looked at the important properties of the feature map: its ability to approximate the input space, the topological ordering that emerges, the matching of the input

The goals (i)-(iv) will then be achieved based on an estimation and inference method for the change-point problem in exponential families: the Simultaneous MUltiscale Change-