+ All Categories
Home > Documents > CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer...

CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer...

Date post: 07-Oct-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
61
CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University of Pittsburgh September 29, 2020
Transcript
Page 1: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

CS 1674: Intro to Computer Vision

Geometric Transformations and Multiple Views

Prof. Adriana KovashkaUniversity of Pittsburgh

September 29, 2020

Page 2: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Why multiple views?

• Structure and depth are inherently ambiguous from

single views.

• Multiple views help us perceive 3d shape and depth.

Kristen Grauman, images from Svetlana Lazebnik

Page 3: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Alignment problem

• We previously discussed how to match features

across images, of the same or different objects

• Now let’s focus on the case of “two images of the

same object”(e.g. xi and xi’)

• What transformation relates xi and xi’?

• In alignment, we will fit the parameters of some

transformation according to a set of matching

feature pairs (“correspondences”).

T

xi

xi'

Adapted from Kristen Grauman and Derek Hoiem

Page 4: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Image from http://graphics.cs.cmu.edu/courses/15-463/2010_fall/Kristen Grauman

Motivation: Image mosaics

Page 5: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

?

• Compare content in local patches, find best matches.

• Scan xi’ with template formed from a point in xi, and compute

e.g. Euclidean distance between pixel intensities in the patch

• Or compare SIFT features

Adapted from Kristen Grauman

Min dist = match

First, what are the correspondences?

Page 6: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Second, what are the transformations?

Examples of transformations:

translate rotate change aspect ratio

squish/shear change perspective

Adapted from Alyosha Efros

Page 7: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Parametric (global) warping

Transformation T is a coordinate-changing machine:

p’ = T(p)

What does it mean that T is global?

• It is the same for any point p

• It can be described by just a few numbers (parameters)

Let’s represent T as a matrix:

p’ = Mp

T

p = (x,y) p’ = (x’,y’)

=

y

x

y

xM

'

'

Alyosha Efros

Page 8: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Scaling

Scaling a coordinate means multiplying each of its components by a scalar

Uniform scaling means this scalar is the same for all components:

2

Adapted from Alyosha Efros

(2, 1)

(4, 2)

Page 9: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Scaling

Non-uniform scaling: different scalars per component

X 2,

Y 0.5

Adapted from Alyosha Efros

(2, 1)(4, 0.5)

Page 10: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Scaling

Scaling operation:

Or, in matrix form:

byy

axx

=

=

'

'

=

y

x

qp

nm

y

x

'

'

scaling matrix S

Adapted from Alyosha Efros

=

y

x

b

a

y

x

0

0

'

'

x’ = mx + ny

y’ = px + qy

Page 11: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

2D Linear transformations

Only linear 2D transformations can be represented with

a 2x2 matrix.

Linear transformations are combinations of …

• Scale,

• Rotation,

• Shear, and

• Mirror

=

y

x

dc

ba

y

x

'

'

Alyosha Efros

Page 12: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

2D Rotate around (0,0)? (see next slide)

yxyyxx

*cos*sin'*sin*cos'

+=−=

−=

y

x

y

x

cossin

sincos

'

'

2D Shear?

yxshy

yshxx

y

x

+=

+=

*'

*'

=

y

x

sh

sh

y

x

y

x

1

1

'

'

2D Scaling?

ysy

xsx

y

x

*'

*'

=

=

=

y

x

s

s

y

x

y

x

0

0

'

'

Modified from Alyosha Efros Fig. from https://www.siggraph.org/education/materials/HyperGraph/modeling/mod_tran/2dshear.htm

What transforms can we write w/ 2x2 matrix?

Page 13: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

2D Rotation: Example

Θ = 90 → M = [0 -1; 1 0], i.e. x' = -y, y' = x

X’ = -Y,

Y’ = X(2, -4)

(4, 2)

(5, -2)

(2, 5)

−=

y

x

y

x

cossin

sincos

'

'

Page 14: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Polar coordinates…

x = r cos (f)

y = r sin (f)

x’ = r cos (f + )

y’ = r sin (f + )

Trig Identity…

x’ = r cos(f) cos() – r sin(f) sin()

y’ = r sin(f) cos() + r cos(f) sin()

Substitute…

x’ = x cos() - y sin()

y’ = x sin() + y cos()

(x, y)

(x’, y’)

f

Adapted from Derek Hoiem, reference: https://www2.clarku.edu/faculty/djoyce/trig/identities.html

2D Rotation: How to write

−=

y

x

y

x

cossin

sincos

'

'

Page 15: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

2D Mirror about Y axis?

yyxx

=−=

''

−=

yx

yx

1001

''

2D Mirror over (0,0)?

yyxx

−=−=

''

−=

yx

yx

1001

''

2D Translation?

y

x

tyy

txx

+=

+=

'

'CAN’T DO!

Alyosha Efros

What transforms can we write w/ 2x2 matrix?

Page 16: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

homogeneous image

coordinates

Converting from homogeneous coordinates

To convert to homogeneous coordinates:

Adapted from Kristen Grauman

Homogeneous coordinates

Simple example:

y = mx + b vs y = mx where m = [m b], x = [x

1]

Page 17: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

+

+

=

=

111

'

'

y

x

ty

tx

y

x

y

x

Translation

+

+

=

=

11100

10

01

1

'

'

y

x

y

x

ty

tx

y

x

t

t

y

x

tx = 3

ty = 1

Homogeneous Coordinates

Adapted from Alyosha Efros

(2, 1)

(5, 2)

Page 18: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

2D affine transformations

Affine transformations are combinations of …

• Linear transformations, and

• Translations

Maps lines to lines, parallel lines remain parallel

=

w

y

x

fed

cba

w

y

x

100'

'

'

Adapted from Alyosha Efros

Page 19: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Fitting an affine transformation

• Assuming we know the correspondences, how do we

get the transformation?

),( ii yx ),( ii yx

+

=

2

1

43

21

t

t

y

x

mm

mm

y

x

i

i

i

i

=

i

i

ii

ii

y

x

t

t

m

m

m

m

yx

yx

2

1

4

3

2

1

1000

0100

Alyosha Efros

Page 20: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Fitting an affine transformation

• How many matches (correspondence pairs) do we

need to solve for the transformation parameters?

• Once we have solved for the parameters, how do we

compute given ?

=

i

i

ii

ii

y

x

t

t

m

m

m

m

yx

yx

2

1

4

3

2

1

1000

0100

),( newnew yx

Adapted from Kristen Grauman

)','( newnew yx

Page 21: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Detour: Keypoint matching for search

Adapted from K. Grauman, B. Leibe

AfBf

A1

A2 A3

Tffd BA ),(

1. Find a set of

distinctive key-

points

2. Define a region

around each

keypoint (window)

3. Compute a local

descriptor from the

region

4. Match descriptors

QueryIn database

Page 22: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Detour: solving for translation with outliers

A1

A2 A3B1

B2 B3

Given matched points in {A} and {B}, estimate the translation of the object

+

=

y

x

A

i

A

i

B

i

B

i

t

t

y

x

y

x

Derek Hoiem

Page 23: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Detour: solving for translation with outliers

A1

A2 A3B1

B2 B3

(tx, ty)

Problem: outliers

A4

A5

B5

B4

Adapted from Derek Hoiem

Hough transform solution

+

=

y

x

A

i

A

i

B

i

B

i

t

t

y

x

y

x

1. Initialize a grid of parameter values

2. Each matched pair casts a vote for

consistent values

3. Find the parameters with the most votestx

ty

Page 24: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Detour: solving for translation with outliers

A1

A2 A3B1

B2 B3

Hough transform solution

(tx, ty)

1. Initialize a grid of parameter values

2. Each matched pair casts a vote for

consistent values

3. Find the parameters with the most votes

A4

A5 A6

B4

B5 B6

Problem: multiple objects

Adapted from Derek Hoiem

+

=

y

x

A

i

A

i

B

i

B

i

t

t

y

x

y

x

tx

ty

Page 25: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

2D projective transformations

Projective transformations:

• Affine transformations, and

• Projective warps

Parallel lines do not necessarily remain parallel

=

w

yx

ihg

fedcba

w

yx

'

''

Kristen Grauman

Page 26: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Projective transformations

A projective transformation is a mapping between any two

projective planes with the same center of projection

Also called Homography

PP2

PP1

=

1

yx

*********

w

wy'wx'

H pp’

Adapted from Alyosha Efros

Page 27: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Image mosaics: Camera setup

Two images with camera rotation but no translation

Camera CenterAdapted from Derek Hoiem

(0, 0) (0, 0)

(50, 70) (50, 20)

Page 28: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Obtain a wider angle view by combining multiple images.

imag

e fro

m S

. Seitz

. . .

Kristen Grauman

Image mosaics: Goals

Page 29: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

mosaic plane

Image mosaics: Many 2D views, one 3D object

The mosaic has a natural interpretation in 3D• The images are reprojected onto a common plane

• The mosaic is formed on this plane

• Mosaic is a synthetic wide-angle cameraSteve Seitz

Page 30: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

How to stitch together panorama (mosaic)?

Basic Procedure

• Take a sequence of images from the same position

– Rotate the camera about its optical center

• Compute the homography (transformation)

between first and second image

• Combine images (draw first image onto

second’s canvas)

• Blend the two together to create a mosaic (post-

process)

• (If there are more images, repeat)

Adapted from Steve Seitz

Page 31: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

( )11, yx ( )11, yx

To compute the homography given pairs of corresponding

points in the images, we need to set up an equation where

the parameters of H are the unknowns…

( )22 , yx ( )22 , yx

( )nn yx , ( )nn yx ,

Kristen Grauman

Computing the homography

Page 32: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Computing the homography

• Assume we have four matched points:

How do we compute homography H?

=

w

wy'

wx'

'p

=

987

654

321

hhh

hhh

hhh

H

=

9

8

7

6

5

4

3

2

1

h

h

h

h

h

h

h

h

h

h

Adapted from Derek Hoiem, Kristen Grauman

p’=Hp

0h =

−−−

−−−

'''1000

'''0001

yyyxyyx

xyxxxyx

A

=

1

y

x

ihg

fed

cba

w

wy'

wx'

987

654

321

hhh

hhh

hhh

Derivation: http://www.cse.psu.edu/~rtc12/CSE486/lecture16.pdf (pp. 25-36)

Can set scale factor h9 = 1.

So, there are 8 unknowns.

Need at least 8 eqs, but the more the better…

=

1

y

x

p

DEMO

Page 33: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

How to stitch together panorama (mosaic)?

Basic Procedure

• Take a sequence of images from the same position

– Rotate the camera about its optical center

• Compute the homography (transformation)

between first and second image

• Combine images (draw first image onto

second’s canvas)

• Blend the two together to create a mosaic (post-

process)

• (If there are more images, repeat)

Adapted from Steve Seitz

Page 34: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

=

1

yx

*********

w

wy'wx'

H pp’

wyw

wxw

,

( )yx = ,

( )yx,

To apply a given homography H

• Compute p’ = Hp (regular matrix multiply)

• Convert p’ from homogeneous to image

coordinates

Modified from Kristen Grauman

Combining imagesImage 2 canvasImage 1

Page 35: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

f(x,y) g(x’,y’)

Combining images

Forward warping:

Send each pixel f(x,y) to its corresponding location

(x’,y’) = H(x,y) in the right image

x x’

H(x,y)

y y’

Modified from Alyosha Efros

Image 2 canvasImage 1

Page 36: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

f(x,y) g(x’,y’)

Combining images

x x’

H(x,y)

Q: what if pixel lands “between” two pixels?

y y’

A: round values of (x’,y’) or distribute color among neighbors

Adapted from Alyosha Efros

Forward warping:

Send each pixel f(x,y) to its corresponding location

(x’,y’) = H(x,y) in the right image

Page 37: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

f(x,y) g(x’,y’)x

y

Combining images

Inverse warping:

Get each pixel g(x’,y’) from its corresponding location

(x,y) = H-1(x’,y’) in the left image

x x’

y’H-1(x,y)

Modified from Alyosha Efros

Image 2 canvasImage 1

Page 38: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

f(x,y) g(x’,y’)x

y

Combining images

x x’

H-1(x,y)

Q: what if pixel comes from “between” two pixels?

y’

A: interpolate color value from neighbors

Alyosha Efros

Inverse warping:

Get each pixel g(x’,y’) from its corresponding location

(x,y) = H-1(x’,y’) in the left image

Page 39: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Homography example: Image rectification

To unwarp (rectify) an image solve for homography H

given p and p’: p’=Hp

pp’

Derek Hoiem

(4, 2) (4, 4)

(2, 2) (2, 4)

Page 40: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

• Write 2d transformations as matrix-vector multiplication

(including translation when we use homogeneous

coordinates)

• Fitting transformations: solve for unknown parameters

given corresponding points from two views – linear,

affine, projective (homography)

• Mosaics: uses homography and image warping to

merge views taken from same center of projection

• Perform image warping (forward, inverse)

Adapted from Kristen Grauman

Summary of affine/projective transforms

Page 41: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Next: Stereo vision

• Homography: Same camera center, but camera rotates

• Stereo vision: Camera center is not the same (we have multiple cameras)

• Epipolar geometry– Relates cameras from two positions/cameras

• Stereo depth estimation– Recover depth from disparities between two images

Adapted from Derek Hoiem

Page 42: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Stereo photography and stereo viewers

Image from fisher-price.com

Take two pictures of the same subject from two slightly different

viewpoints and display so that each eye sees only one of the images.

Kristen Grauman

Invented by Sir Charles Wheatstone, 1838

Page 43: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Two cameras, simultaneous

views

Single moving camera and

static scene

Kristen Grauman

Depth from stereo for computers

Page 44: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

f

x x’

Baseline

B

z

C C’

X

f

X

x

x'

Derek Hoiem

Depth from stereo• Goal: recover depth by finding image coordinate x’

that corresponds to x

Page 45: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

• Goal: recover depth by finding image coordinate x’ that corresponds to x

• Sub-Problems1. Calibration: How do we recover the relation of the

cameras (if not already known)?

2. Correspondence: How do we search for the matching point x’?

3. Estimate depth from matchesX

x

x'

Derek Hoiem

Depth from stereo

Page 46: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

• Assume parallel optical axes, known camera parameters

(i.e., calibrated cameras). What is expression for Z?

Similar triangles (pl, P, pr) and

(Ol, P, Or):

Geometry for a simple stereo system

Z

T

fZ

xxT rl =−

−+

lr xx

TfZ

−=

disparity

Adapted from Kristen Grauman

depth

Depth is inversely proportional to disparity.

Page 47: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Depth from disparity

image I(x,y) image I´(x´,y´)Disparity map D(x,y)

Kristen Grauman

• We have two images from different cameras.

• If we could find the corresponding points in two images,

we could estimate relative depth…

• How do we match a point in the first image to a point in the

second efficiently?

Page 48: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

• Given p in left image, where can corresponding

point p’ be?

Stereo correspondence constraints

Kristen Grauman

Page 49: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

• Epipolar Lines - intersections of epipolar plane with image

planes (always come in corresponding pairs)

Epipolar geometry: notationP

p p’

• Epipolar Plane – plane containing baseline

• Epipoles

= intersections of baseline with image planes

= projections of the other camera center

• Baseline – line connecting the two camera centers

Adapted from Derek Hoiem

Page 50: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Epipolar constraint

Geometry of two views constrains where the corresponding pixel for

some image point in the first view must occur in the second view.

• It must be on the line where (1) the plane connecting the world

point and optical centers, and (2) the image plane, intersect.

• Potential matches for p have to lie on the corresponding line l’.

• Potential matches for p’ have to lie on the corresponding line l.

Adapted from Kristen Grauman, Derek Hoiem

world point

Page 51: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Epipolar constraint

The epipolar constraint is useful because

it reduces the correspondence problem

to a 1D search along an epipolar line.

Kristen Grauman, image from Andrew Zisserman

Page 52: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Stereo geometry, with calibrated cameras

• If the stereo rig is calibrated, we know how to rotate and translate

camera reference frame 1 to get to camera reference frame 2• Rotation: 3x3 matrix R; translation: 3x1 vector T.

TRXX +='

Adapted from Kristen Grauman

(See hidden slides for how we get to the next slide.)

Page 53: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Essential matrix

( ) 0= RXTX

( ) 0][T = RXX x

E is called the essential matrix, and it relates corresponding image

points between both cameras, given the rotation and translation.

Before we said: If we observe a point in one image, its position in other

image is constrained to lie on line defined by above. It turns out that:• ETx is the epipolar line l’ through x’ in the second image, corresponding to x.

• Ex’ is the epipolar line l through x in the first image, corresponding to x’.

Let RE ][T x=

0== EXXEXXT

Adapted from Kristen Grauman, Derek Hoiem

Page 54: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

==

−=

=

]R[E

T

IR

xT

]0,0,[ d0 0 0

0 0 d

0 –d 0

0=Epp

Essential matrix example: parallel cameras

For the parallel cameras,

image of any point must lie

on same horizontal line in

each image plane.

],','[

],,[

fyx

fyx

=

=

p'

p

Kristen Grauman

Page 55: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

image I(x,y) image I´(x´,y´)Disparity map D(x,y)

(x´,y´)=(x+D(x,y),y)

Adapted from Kristen Grauman

Page 56: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Basic stereo matching algorithm

• For each pixel in the first image– Find corresponding epipolar scanline in the right image– Search along epipolar line and pick the best match x’: slide a window along the

right scanline and compute Euclidean distance between contents of that window with the reference window in the left image; take the window corresponding to the minimum as the match

– Compute disparity x-x’ and set depth(x) = f*T/(x-x’)

Adapted from Derek Hoiem

Page 57: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Results with window searchData

Window-based matching Ground truth

Left image Right image

Predicted depth Ground truth

Derek Hoiem

Page 58: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Summary of stereo vision

• Epipolar geometry– Epipoles are intersection of baseline with image planes– Matching point in second image is on a line passing

through its epipole– Epipolar constraint limits where points from one view will

be imaged in the other, which makes search for correspondences quicker

– Essential matrix E maps from a point in one image to a line (its epipolar line) in the other

• Stereo depth estimation– Find corresponding points along epipolar scanline– Estimate disparity (depth is inverse to disparity)

Adapted from Kristen Grauman and Derek Hoiem

Page 59: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Projective structure from motion

• Given: m images of n fixed 3D points

xij = Pi Xj , i = 1,… , m, j = 1, … , n

• Problem: estimate m projection matrices Pi and n 3D points Xj from the mn corresponding 2D points xij

x1j

x2j

x3j

Xj

P1

P2

P3

Svetlana Lazebnik

Page 60: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Photo tourism

Noah Snavely, Steven M. Seitz, Richard Szeliski, "Photo tourism: Exploring

photo collections in 3D," SIGGRAPH 2006

http://phototour.cs.washington.edu/

Page 61: CS 1674: Intro to Computer Visionkovashka/cs1674_fa20/vision_05... · CS 1674: Intro to Computer Vision Geometric Transformations and Multiple Views Prof. Adriana Kovashka University

Sameer Agarwala, Noah Snavely, Ian Simon, Steven M. Seitz, Richard

Szeliski, "Building Rome in a Day," ICCV 2009

3D from multiple images


Recommended