127
Computer Vision No. 7: Stereo part 2

Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Embed Size (px)

Citation preview

Page 1: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Computer Vision

No. 7: Stereo part 2

Page 2: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Today’s topics

Projective geometry Camera Projection Matrix F Matrix Multi View Shape Reconstruction

Page 3: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Elementary Projective Geometry

Page 4: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Topics

1. Projective Plane

2. Projective Space

3. Affine Space

4. Euclidean Space

Page 5: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Projective Plane  (2D projective space)

In the Euclidean plane ),(: yxp

In the Projective plane )1,,(: yxp

Simply add a third coordinate of 1 at the end

Homogeneous coordinate

! Scaling is NOT important.

),,()1,,( yxyx Therefore the point (0, 0, 0) is disallowed in the projective plane.

)0,,( yx : Ideal points or Points at infinity

Page 6: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Description in Projective Plane

A line in the projective plane is described as…

A line through the point (x, y)…

0 cbyax

0),,()1,,( cbayx

),,( cbal

A line through a point

0 pllp tt

l p

Page 7: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Duality in Projective Plane

A point and a line ),,( cbal ),,( wyxp

The line through point and1p 2p 21 ppl

If point , and are on the same line1p 2p 3p

0det 321 ppp

The cross point of line and1l 2l 21 llp

If line , and are passing through the same point1l 2l 3l

0det 321 lll

Page 8: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Conics and Dual Conics

For symmetric 3 x 3 matrix …

All points which satisfy ….p

0pp tConic

Dual Conic

Therefore, for the matrix )( 1*

All lines which satisfy ….l

0* ll t

Page 9: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Transformation in Projective Plane

In the Projective plane, by 3 x 3 non-singular matrix T

A point is transformed intop p pTp

A line is transformed intol l

lTlplTpTTlpl ttttt )(0 1

A conic is…

1

11 )(0

TT

pTTppTTTTpppt

tttttt

Similarly a dual conic is…* tTT **

Page 10: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

In the Euclidean space ),,(: ZYXP

In the Projective space )1,,,(: ZYXP

Homogeneous coordinate

! ),,,()1,,,( ZYXZYX

)0,,,( ZYX : Ideal points, Points at infinity

A plane in the projective space is described as…

),,,( DCBAL

A plane through a point 0 PLLP ttL ),,,( WZYXP

Projective Space (3D Projective space)

Page 11: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Quadrics and Dual Quadrics

For symmetric 4 x 4 matrix …All points which satisfy ….P

0PP tQuadric

Dual Quadric

Therefore, for the matrix )( 1*

All planes which satisfy ….L

0* LLt

Similarly a dual quadric is…* tTT **

A quadric is transformed by T into 1 TT t

Page 12: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

N-Dimensional Affine Space

Among transformations T in the N-d projective space

0,0det,matrixsingular -non: 0

cANNA

c

bAT aat

aA

Affine Transformation

In N-D affine space… )0,( p

: point at infinity

The group of the points at infinity )1,0(

: plane at infinity

By an affine transformation

000

pAp

c

bA a

ta

a point at infinity

a point at infinity

Page 13: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

N-Dimensional Euclidean Space

Among N-d affine transformations

0,,matrix orthogonal: 0

1

cAANNA

c

bAT e

teet

eE

Euclidean Transformation

AT

a group of points at infinity, which satisfy)}0,{( ep

0et

e pp

By an Euclidean transformation

0 et

eeet

et

eet

e pppAAppp

N=3: Absolute conic

N=2: Absolute point

Page 14: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

3-Dimensional Euclidean Space

1,33: 0

RRR

c

bRT t

tE

By an Euclidean transformation

0

1

1

1

*E

Absolute Dual Quadric

***

0

0

00Ett

tEEEE

I

cb

RI

c

bRTT

The absolute dual quadric is invariant under Euclidean transformation!

*E

Page 15: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Camera Projection

Page 16: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Topics

1. Pinhole Camera Model

2. Camera Parameters

3. Lens Distortion

Page 17: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Pinhole Camera

Page 18: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Pinhole Camera Modelgeometry

(X, Y, Z)

Image plane

X

Y

-Zx

y

(x, y)

Z

Y

Z

Xyx ,),(

Perspective projection

View point

(Optical center)

(sX, sY, sZ)

Page 19: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Pinhole Camera ModelThe projected point on the image plane (z = -1)

321

2

1

3

,)(

)(

)(

1rrrR

tPr

tPr

tPry

xt

t

t

The Rotation matrix of camera pose

The camera position t

R

In Projective Geometry

PtIRP

tIRtPR

tPr

tPr

tPr

tPry

x

p ttt

t

t

t

t

,

1,

)(

)(

)(

)(

1

1 3

2

1

3

Page 20: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Intrinsic parameters

yAn ideal image on the Image plane

x

u

v

θ An actual picture

u0

v0

(x, y)

(u, v)

pAy

x

vk

ukk

v

u

u v

uu

1100

sin0

cot

10

0

the Principal point

skew

Page 21: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Intrinsic parameters

yAn ideal image on the Image plane

x

u

v

θ An actual picture

u0

v0

(x, y)

(u, v)

the Principal point

skew

pAy

x

vfa

usf

v

u

u

1100

0

10

0

f : Focal Length

a : aspect ratio

Page 22: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Camera Projection Matrix

PtIARpAv

u

u t

,

1

Transformation of a point in the 3D world into a 2D picture…

tIARP tc

,Camera Matrix (3 x 4)

Camera calibration

11 parameters: rotation 3 + translation 3 + intrinsic 5

Estimate of these 11 parameters (= camera matrix)

Page 23: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Lens distortion

Short focal length Long focal length

Page 24: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Removal of lens distortion

Page 25: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Lens DistortionZ.Zhang (‘00) PAMI

R. Sagawa (‘05) IROS Non-parametric

Page 26: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

F Matrix

Page 27: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Topics

1. Epipolar Geometry

2. E & F Matrix

3. Homography

4. Multi View Geometry

Page 28: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Correspondence Problem

Given two images, we want to solve a problem……

For a point in image 1, decide which point in image 2 it corresponds to.

?

plane 1

plane 2

Eye 1Eye 2

Page 29: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Epipolar Geometry

C1

C2

3D point Epipolar plane

EpipoleEpipole

Epipolar line

Epipolar line

Baseline

Page 30: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Essential Matrix

C1

C2

t

2p

1p

xRt p

tt

tt

tt

ptpt

0

0

0

12

13

23 2pRt

021 pRtp t

Essential matrix : E

2pR

Page 31: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Essential & Fundamental Matrix

1p

2p

021 pEp t Image planes

Pictures

1u2u

pApAu

0)(

)()(

21

21

11

21

211

1

21

uAEAu

uAEuA

pEp

tt

t

t

Fundamental matrix : F

Image 1 Image 2

Page 32: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Fundamental Matrix

image 1image 2

1u 2u

constraint

121

21 0

ARtAF

uFut

t Depends on the camera configuration!!

Page 33: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Fundamental Matrix PtIRApAu

PtIRApAu

t

t

222222

111111

,

,

tRAPRAPtIRApAu

PAPIIApAu

ttt

t

222222

11111

,

0,

tRAuARAu tt 21

1122

tuRAuA

,, 21

211

1 are on the same plane!Three vectors

021

21121

211

1

uRAtAuuRAtuA ttt

Page 34: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Epipolar Constraint

0

1

1,, 2

2

1121

v

u

FvuuFu t

tt lFvuFu 1111 1,,

Page 35: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Epipolar Constraint

0

1

1,, 2

2

1121

v

u

FvuuFu t

22

2

2

1

lv

u

FuF

Page 36: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Property of F Matrix

12

12

13

23

11

21

0

0

0

RA

tt

tt

tt

AARtAF tt

at most Rank 2

0det F

0

0

0

,0

3

2

1

e

e

e

e

FeF

There are some points which satisfye

Page 37: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Null Space of F Matrix (epipole)

1, uF for 021 eFu t

1u2e

All epipolar lines in image 2 pass through the point 2e

Page 38: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Null Space of F Matrix (epipole)

2u1e

Similarly, 2ufor 021 uFe t

21,ee : Epipoles

All epipolar lines in image 1 pass through the point 1e

Page 39: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Epipoles

Epipoles:• intersections of baseline with image planes• projection of the optical center in another image• the vanishing points of camera motion direction

C1

C2

e1e2

Page 40: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Examples

Page 41: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Examples

Page 42: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Examples

Page 43: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Computing F Matrix (8-point algorithm)021 uFu t

0

1

1 2

2

333231

232221

131211

11

v

u

FFF

FFF

FFF

vu

01

33

32

31

23

22

21

13

12

11

112212122121

F

F

F

F

F

F

F

F

F

vuvvvvuuuvuu

1& F

Page 44: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Computing F Matrix

Epipolar pencil by linear solution (due to noise and error)

Page 45: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Computing F MatrixSingular value decomposition (SVD)

321

3

2

1

00

00

00

tVUF

2rank F Without noise, σ3 must be 0

modification

tVUF

000

00

00

2

1

Page 46: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Computing F Matrix

tVUF

3

2

1

00

00

00

tVUF

000

00

00

2

1

Page 47: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Homography

ij

d

n

P

In Camera 1

Camera 1

Camera 2

PAPIAu

111 0

1Pnd t

The distance between camera 1 and the plane

In Camera 2

121222 Pd

ntIRAtPRAPtIRAu

tttt

Page 48: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Homography and F Matrix

ij

d

n

P

Camera 1

Camera 2

11

122 uAd

ntIRAu

tt

12 uHu

0111

112

121

ttAtAAd

ntIRARAtAFH t

ttt

0)( 111

111

111

AttAAtAAtAFHFH tttttt

Page 49: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Planer homography mosaicing

Page 50: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Planer homography mosaicing

camera

Image plane’

Page 51: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Image rectification

Camera 1 Camera 2

Page 52: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Rectification

Fusiello (MVA 2000) Pollefeys

Page 53: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Constraints of 3 images

L

1l2l

3l

13

12

11

1

l

l

l

l

23

22

21

2

l

l

l

l

33

32

31

3

l

l

l

l

Line – line – line

13

332

12

322

11

312

llTl

llTl

llTl

t

t

t

Tensor TrifocaliT

3 x 3 matrix

Page 54: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Constraints of 3 imagesL

1l2l

3l

Line – line – line

132i

ijkkj lTll

Tensor description

L

2l

3l

Point – line – line

1u 0321 ijkkji Tllu

13

12

11

1

u

u

u

u

Page 55: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Constraints of 3 images

Point – point – line

ri

pkkjprji Tluu 0321

rsi

pqkqskjprji Tuuu 0321

L

2u

3l

1u

Point – point – point

2u

3u

1u

otherwise

123 ofn permutatio oddan is

123 ofn permutatioeven an is

0

1

1

rst

rst

rst

Page 56: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

2-Views Geometry

2u1u

X

matrix 43 scalar,

ii

ii

i

P

XPu

00

02

122

11

X

uP

uP

M : (3 x 2) x (4 + 2) matrix

0detif M 0

2

1

X

Page 57: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

2-Views Geometry

2u1u

X

matrix 43 scalar,

ii

ii

i

P

XPu

00

02

122

11

X

uP

uP

M : (3 x 2) x (4 + 2) matrix

0det M 021 ijji Fuu

In tensor form

Page 58: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

3-Views Geometry

2u

3u

1u

X

matrix 43 scalar,

ii

ii

i

P

XPu

00

0

00

0

0

3

2

1

33

22

11

X

uP

uP

uP

M : (3 x 3) x (4 + 3) matrix

0det M rsi

pqkqskjprji Tuuu 0321

Page 59: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

4-Views Geometry

2u

3u

1u

X

00

0

0

000

00

00

00

4

3

2

1

44

33

22

11

X

uP

uP

uP

uP

0det M

wxyzpqrslszlkrykjqxjipwi Quuuu 04321

4u

tensorlquadrifocapqrsQ

Page 60: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Camera Calibration

Page 61: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Topics

1. 3D Ref.

2. 2D Ref.

3. 1D Ref.

4. Self Calibration (Kruppa equations)

Page 62: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

The meaning of camera calibration

tIARP tc

,

0

1

1

1

*E

Absolute Dual Quadric

*E

ttt

ttcEc AARA

t

IItIARPP

0**

Camera Calibration = to estimate the image of the absolute quadric

*

Page 63: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Camera Calibration (3D Ref.)

11 34

24

14

333231

232221

131211

Z

Y

X

P

P

P

PPP

PPP

PPP

v

u

known

tcec

t PPAA **

tIARP tc

,

Page 64: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Homography  ( 2D-2D mapping )

11 34

24

14

333231

232221

131211

Z

Y

X

P

P

P

PPP

PPP

PPP

v

u

ij

d

(x, y)

1100

1

y

xdji

Z

Y

X

xHy

x

MPv

u

u c

11

(u, v)

Homography (3 x 3)

the origin

Page 65: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Camera Calibration (2D Ref.)

Without loss of generality…

0,

tIR

0

IAPc

djiAdji

AMPH c

1000

Z.Zhang (‘00) PAMI

Page 66: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Camera Calibration (2D Ref.)

djiAH

11 333231

232221

131211

y

x

HHH

HHH

HHH

v

u

known

0

1

ji

jjiit

tt

0

1

t

tttt AA

Page 67: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Camera Calibration (2D Ref. Results)

Page 68: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Camera Calibration (1D Ref.)Z.Zhang (‘04) PAMI

1P

3P

2P1u

3u

2u

213 )1( PPP

On the line in 3D

2133 )1( uuPPu c

22111 ,0 PAuPAPIAu

1

1,1)1(

121

122

11

212

122 uuAAuuuAuAPPL tt

:const. 1P :fix

Page 69: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Camera Calibration (1D Ref. Results)

Page 70: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Self Calibration

In most cases, there are NOT any reference objects…

be able to calibrate the camera by unknown scenes

Page 71: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Homography at infinity

P

Camera 1

Camera 2

Considering P on the infinity plane …

)0,,,()0,( ZYXPP t

0222 ZYXPP t

and on the absolute quadric…

PRPtIRp tt

0 PPPRRPpp tttt

In camera 2 coordinate system

Page 72: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

The image of the absolute quadric

P

Camera 1

Camera 2

PAu

11

The image of the absolute quadric at the infinity plane

0111

11

111

uu

uAAuPPt

ttt

011*

111 ueue t

01*

11 ll t

Page 73: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

The Kruppa equations

P

Camera 1

Camera 2

1

011

*111

11*

111

ueeu

ueue

tt

t

02*

22 ll t

tt lFu 21

01*

21 uFFu tt

tt FFee *21

*11

2Given the F Matrix…

Page 74: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

References

Multiple View GeometryHartley and Zisserman, Cambridge

The Geometry of Multiple ImagesFaugeras and Luong, MIT

Three-Dimensional Computer VisionFaugeras, MIT

Algebraic Projective GeometrySemple and Kneebone, Oxford

Page 75: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Multiple View Shape Reconstruction

Page 76: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Topics

•Basic Principle•Surface Approach

Multi-baseline stereo•Volumetric Approach

Volume intersection method•Combinatorial Approach

Photo hull

•Extended Algorithm•Level Set Approach•Graph-cut Approach

Page 77: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Basic Principle #1

Surface Approach

Page 78: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Surface Approach Try to reconstruct a surface of an object

– Find depth d that minimizes some matching cost function F (d) defined on N views

Camera 1

Camera 2Camera N

)(dF

d

d

Page 79: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Matching Cost Function

2

11,

),(),()(

wcc

cNc

ybd

fxIyxIdF

)),(()),((

)),(),,(()(

1

1

1, ybdf

xIVaryxIVar

ybdf

xIyxICovdF

cc

cc

cNc

(b) SSSD (sum of sum. of squared difference)

(a) SSAD (sum. of sum of absolute difference)

w

cccNc

ybd

fxIyxIdF ),(),()( 1

1,

(c) SNCC (sum of normalized cross correlation)

Camera 1 (reference) Camera 2 Camera N

Epipolar line

2bd

fNb

d

f

Page 80: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Why Multiple Views? Binocular stereo is sometimes ambiguous

e.x. F(d) = SAD (sum. of absolute difference)

w

ybd

fxIyxI ),(),( 21

d

Camera 1 Camera 2

)(dF

d

Which is the right match?

b

Page 81: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Multi-baseline Stereo

T. Kanade, M. Okutomi, and T. Nakahara, "A Multiple-Baseline Stereo Method," Proc. ARPA Image Understanding Workshop, pp. 409-426, 1992.

Camera 1(reference)

Camera 2

d

Camera 3 Camera N

d

SAD2

d

SSAD

d

SAD3

d

SADN

Unique minima

cSAD

Page 82: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Video-rate Stereo Vision Hardware implementation is easy

S. Kimura, T. Kanade, H. Kano, A. Yoshida, E. Kawamura, K. Oda, “CMU video-rate stereo machine", Proc. of Mobile Mapping Symposium, 1995

Image capture

Apply LoG filter

SSAD computationDisparity computation

Block matchingLUT instead of rectificationSAD computation

2

22

22

22

4 21

1),(

yx

eyx

yxLoG

Page 83: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Real-time Robot Vision

9 cameras stereo

Page 84: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Real-time Robot Vision

Model-based 3D Object Tracking

Page 85: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Virtualized Reality ™ 51 video cameras surrounding the scene

– Recorded to VCR

– Off-line 3D modeling

T. Kanade, P. Rander, P. J. Narayanan, “Virtualized Reality: Constructing Virtual Worlds from Real Scenes”, IEEE MultiMedia, vol.4, no.1, pp.34-47, 1997

Large scene from overlapped dense stereo images

Input images

3D video

Page 86: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Basic Principles #2

Volumetric Approach

Page 87: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Volumetric Approach Try to reconstruct a volume that contains an object

– Detect silhouette in each image– Backproject each silhouette– Intersect backprojected volumes

Binary ImagesBinary Images

Page 88: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Volume Intersection

Reconstruction contains the true scene– But is generally not the same

Page 89: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Visual Hull Minimum convex hull of an object

⇒ A volume obtained from infinite number of surrounding cameras

Visual hullTrue shape

Reconstructed

volume

Concave area is never recovered

Bound of the reconstruction

Page 90: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Voxel Algorithm for Volume Intersection

Find voxel that is projected inside silhouette in all the images– O(NM3), for N images, M3 voxels

– Don’t have to search 2M3 possible scenes!

Octree representation

Page 91: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Acceleration via Octree

Find voxel that is projected inside silhouette in all the images– Multi-resolution approach– Voxels that project to only background pixels in any image are carved– Voxels that project to only foreground pixels in all images remain– Ambiguous voxels are subdivided

Resolution 1Resolution 1

Page 92: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Acceleration via Octree

Find voxel that is projected inside silhouette in all the images– Multi-resolution approach– Voxels that project to only background pixels in any image are carved– Voxels that project to only foreground pixels in all images remain– Ambiguous voxels are subdivided

Resolution 2Resolution 2

Page 93: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Acceleration via Octree

Find voxel that is projected inside silhouette in all the images– Multi-resolution approach– Voxels that project to only background pixels in any image are carved– Voxels that project to only foreground pixels in all images remain– Ambiguous voxels are subdivided

Resolution 3Resolution 3

Page 94: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Results Reconstruction from 4 synthetic images

Silhouette images

16x16x16 voxel space 32x32x32 voxel space 64x64x64 voxel space

Page 95: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

How do we get silhouette images?

Dependent on the purpose of the application

– Interactive Foreground Separation » Building static 3d model from small number of images

– Statistical Background Subtraction » Motion capture system in controlled environment from large

number of image sequence (multiple video streams)

Page 96: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Interactive Foreground Separation

Use of an interactive segmentation program

Y. Li, J. Sun, C.K. Tang, H.Y. Shum, “Lazy snapping,” ACM Trans. on Graphics Vol.23,No. 3, pp.303—308, 2004.

Foreground region Background region

Separation Wrong segmentation

Background region

Separation

See “Example of Graph-cut” in the lecture 6

Page 97: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Building Static 3d Model Volume intersection from 8 images

– No concavities

Page 98: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

•Brightness component

•Chromaticity component

Statistical Background Subtraction

i

i

2)min(arg iiii EE

|||| iii IECD

iE iI

Background image Image of interest

1 i

CDiCD if then pixel Ii is foreground

else if then pixel Ii is shadow

else pixel Ii is shadow

Page 99: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Choice of Threshold Learn statistics of brightness and chromaticity component for

each pixel

1 2 CDBrightness distribution Chromaticity distribution

P % P %P is around 99%

Page 100: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Motion Capture System in Controlled Environment

Input image Foreground & shadow Silhouette image

Page 101: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Basic Principles #3

Combinatorial Approach

Page 102: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Combinatorial Approach1. Start with an initial volume

Arbitrary rectangular shape Result of volume intersection

2. The volume is iteratively carved to be getting closer to the true shape Considering photo-consictency 2 approaches: Voxel coloring and Space-carving

Carve an inconsistentsurface voxel

Page 103: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Photo-consistency

Color variance of the imaged voxel among the cameras

If color variance > thresholdthe voxel is carved

If color variance < thresholdthe voxel is preserved

Voxel of interest

Voxel of interest

True surface

Page 104: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Voxel Coloring Approach

Input ImagesInput Images

(Calibrated)(Calibrated)

Goal: Goal: Assign RGBA values to voxels in VAssign RGBA values to voxels in Vphoto-consistentphoto-consistent with images with images

Discrete formulation

Page 105: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

1. Choose voxel1. Choose voxel2. Project and correlate2. Project and correlate3. Color if photo-consistent3. Color if photo-consistent

Visibility Problem

In what order do we have to choose a voxel?

In which images is each voxel visible?

Page 106: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

The Global Visibility Problem

Inverse Visibility known images

Unknown SceneUnknown Scene

Which points are visible in which images?

Known SceneKnown Scene

Forward Visibility Unknown images

Page 107: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

LayersLayers

Solution: Depth Ordering

SceneScene

TraversalTraversal

Condition:Condition:

voxel space and group of cameras must be completely separatedvoxel space and group of cameras must be completely separated

Visit occluders first

Page 108: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Space-carving Algorithm

General case

Image 1 Image N

…...

– Initialize to a volume V containing the true scene

– Repeat until convergence

– Choose a voxel on the current surface

– Carve if not photo-consistent– Project to visible input images

Page 109: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Output of Space-carving: Photo hull

The Photo Hull is the UNION of all photo-consistent scenes in V

– Tightest possible bound on the true scene

True SceneTrue Scene

VV

Photo HullPhoto Hull

VV

Page 110: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Algorithm finds a surface consistent with the input images, but not necessarily the actual surface

Typical Error in Photo hull

actual surface

reconstructed surface

Cusping artifact Floating voxel artifact

Page 111: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Space-carving Implementation Multi-pass plane sweep

– Efficient, easy to implement

Sweep in –z direction Sweep in -x direction Sweep in -y direction

Repeat

Page 112: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Results

Details are recovered

Volume intersection Space carving Space carvingwith textures

Excessively carved

Input image

Using 16 images300k polygons

Page 113: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Extended Algorithm #1

Level Set Approach

Page 114: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Level Set Approach Define problem in 1 higher dimension

– An additional dimension, time t, is added φ(p(t),t). [Osher98]» P(t) is a point in the space

» Φ(p(t),t) is a signed distance function

– Surface, zero level set φ=0, moves along its normal direction

– Front propagation is guided by Partial Differential Equation (PDE).

– Cross-correlation is used as a constraint in PDE. [Faugeras98]

0)),(( 11 ttp

0)0),0(( p

True shape

Page 115: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

How to move the level set surface

Define a velocity field, F, that specifies surface points move in time– In the case of stereo, F is a function of the matching cost on p

(t) in multi-baseline stereo

– F decreases to 0 around the true surface

Build an initial value for the level set function, φ(p(0),0), based on the initial surface

Adjust φ over time– Surface at time t is defined by φ(p(t),t)=0

Page 116: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Level Set Formulation Constraint: level set value of a point p(t) on the surface must alwa

ys 0

By the chain rule

Since F supplies the speed in the outward normal direction

Hence evaluation equation for φ is

0)),(( ttp

0)(')),(( tpttpt

/ where,)(' nFntp

0 Ft

Essentially a gradient-descent local optimization problem

Page 117: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Front Propagation by PDE Front Propagation can be efficiently calculated in level

set framework– Fast marching method

– Narrow band method

Page 118: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Results

Can handle topology change

Page 119: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Extended Algorithm #2

Graph-cut Approach

Page 120: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

GoalCalibrated images of Lambertian scene

3D model of scene

Page 121: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Volumetric Graph-cuts Energy function to minimize

][][][ SESESE volsurf dAxSE Ssurf )(][

Outer surface (Visual hull)

Inner surface (at constant offset from outer surface)

dVSE SVvol )(][ Volume between outer surface and S

(to avoid over-smoothing)

Reconstructed surface (S)

Integral of photo-consistency over S(S should be photo-consistent))(x Photo-consistency

Page 122: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Designing a Graph

1. Assign a node for each voxel

2. Connect neighboring nodes– Weight is set as ρ(x)

3. Connect outer nodes to source– Weight is infinite

4. Connect inner nodes to sink– Weight is infinite

Outer surface

Inner surface

Sink

Source

)(x

Page 123: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Graph-cut algorithm minimizes the energy

Designing a Graph

1. Connect all the nodes to source– Weight is λ

Outer surface

Inner surface

Sink

Source

A cut that separates source and sink

is equal to

][][][ SESESE volsurf

Cut

Page 124: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Results

Volume intersection

Volumetric Graph-cut

Page 125: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Summary Multi-baseline stereo for accurate depth map

– Good for real-time applications, dense depth map is obtained directly

Voxel-based reconstruction– Volume intersection for conservative estimate– 2 background subtraction methods for different applications– Concavities can be recovered by considering Photo-consistency

Extended algorithm– 2 approaches to add smoothness constraint– Level set approach solves local optimization problem

» can handle topology change

– Graph-cut approach solves global optimization problem» cannot handle topology change

Page 126: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Volume intersection– Martin & Aggarwal, “Volumetric description of objects from multiple views”, Tran

s. Pattern Analysis and Machine Intelligence, 5(2), 1991, pp. 150-158.– Szeliski, “Rapid Octree Construction from Image Sequences”, Computer Vision, Gr

aphics, and Image Processing: Image Understanding, 58(1), 1993, pp. 23-32.

Voxel coloring and Space-carving– Seitz & Dyer, “Photorealistic Scene Reconstruction by Voxel Coloring”, Proc. Comp

uter Vision and Pattern Recognition (CVPR), 1997, pp. 1067-1073.– Kutulakos & Seitz, “A Theory of Shape by Space Carving”, Proc. ICCV, 1998, pp.

307-314.

Extended algorithm– Faugeras & Keriven, “Variational principles, surface evolution, PDE's, level set met

hods and the stereo problem", IEEE Trans. on Image Processing, 7(3), 1998, pp. 336-344.

– G. Vogiatzis and P. H. S. Torr and R. Cipolla, “Multi-View Stereo via Volumetric Graph-Cuts”, Proc. CVPR, 2005, pp.391-398.

References

Page 127: Computer Vision No. 7: Stereo part 2. Today’s topics u Projective geometry u Camera Projection Matrix u F Matrix u Multi View Shape Reconstruction

Next Week

6/7 Motion understanding– Prof. Ikeuchi