1 of 45

Introduction to computer vision 9

Jean Ponce

jean.ponce@ens.fr

Zuhaib Akhtar za2023@nyu.edu

Ayush Jain aj3152@nyu.edu

Slides will be available after classes

2 of 45

Stereopsis

  • Marr-Poggio algorithm
  • Correlation-based stereo
  • Adding global constraints: uniqueness,

ordering, smoothness

  • Adding more cameras

3 of 45

Basic stereo matching algorithm

  • For each pixel in the first image
    • Find corresponding epipolar line in the right image
    • Examine all pixels on the epipolar line and pick the best match
    • Triangulate the matches to get depth information�
  • Simplest case: epipolar lines are scanlines
    • When does this happen?

4 of 45

Rectification

All epipolar lines are parallel in the rectified image plane.

5 of 45

Rectification example

6 of 45

Epipolar constraint example

7 of 45

Reconstruction from Rectified Images

Disparity: d=u’-u.

Depth: z = -B/d.

8 of 45

Binocular fusion: a problem of correspondence

9 of 45

A Cooperative Model (Marr and Poggio, 1976)

Excitory connections: continuity

Inhibitory connections: uniqueness

Iterate: C = Σ C - wΣ C + C .

e

i

0

10 of 45

A Cooperative Model (Marr and Poggio, 1976)

Excitory connections: continuity

Inhibitory connections: uniqueness

Iterate: C = Σ C - wΣ C + C .

e

i

0

Reprinted from Vision: A Computational Investigation into the Human Representation and Processing of Visual Information by David Marr.

© 1982 by David Marr. Reprinted by permission of Henry Holt and Company, LLC.

11 of 45

Correlation Methods (1970--)

Normalized Correlation: minimize θ instead.

Slide the window along the epipolar line until w.w is maximized.

 

12 of 45

Left

Right

scanline

Correlation-based methods

Norm. corr

13 of 45

Failures of correlation-based methods

Textureless surfaces

Occlusions, repetition

Non-Lambertian surfaces, specularities

14 of 45

Effect of window size

    • Smaller window
      • More detail
      • More noise
    • Larger window
      • Smoother disparity maps
      • Less detail

W = 3

W = 20

15 of 45

Results

Correlation-based matching

Ground truth

Data

16 of 45

Correlation Methods: Foreshortening Problems

Solution: add a second pass using disparity estimates to warp

the correlation windows, e.g. Devernay and Faugeras (1994).

Reprinted from “Computing Differential Properties of 3D Shapes from Stereopsis without 3D Models,” by F. Devernay and O. Faugeras,

Proc. IEEE Conf. on Computer Vision and Pattern Recognition (1994). © 1994 IEEE.

17 of 45

How can we improve window-based matching?

  • The similarity constraint is local: each reference window is matched independently.

  • Need to enforce global correspondence constraints.

18 of 45

Non-local constraints

  • Uniqueness
    • For any point in one image, there should be at most one matching point in the other image

19 of 45

Non-local constraints

  • Uniqueness
    • For any point in one image, there should be at most one matching point in the other image
  • Ordering
    • Corresponding points should be in the same order in both views

20 of 45

Non-local constraints

  • Uniqueness
    • For any point in one image, there should be at most one matching point in the other image
  • Ordering
    • Corresponding points should be in the same order in both views

Ordering constraint does not (always) hold

21 of 45

Non-local constraints

  • Uniqueness
    • For any point in one image, there should be at most one matching point in the other image
  • Ordering
    • Corresponding points should be in the same order in both views
  • Smoothness
    • We expect disparity values to change slowly (for the most part)

22 of 45

Scanline stereo

  • Try to coherently match pixels on the entire scanline
  • Different scanlines are still optimized independently

Left image

Right image

23 of 45

“Shortest paths” for scan-line stereo

Left image

Right image

Can be implemented with dynamic programming

(Baker & Binford’81, Ohta & Kanade ’85)

correspondence

q

p

Left occlusion

t

Right

occlusion

s

Slide credit: Y. Boykov

24 of 45

Shortest path stereo in real life

  • Scanline stereo generates streaking artifacts��������
  • Can’t use dynamic programming to find spatially coherent disparities and correspondences on a 2D grid

25 of 45

Stereo matching as energy minimization

I1

I2

D

  • Energy functions of this form can be minimized using “graph cuts” (aka min-cut/max-flow algorithms)

Y. Boykov, O. Veksler, and R. Zabih, Fast Approximate Energy Minimization via Graph Cuts, PAMI 2001

W1(i )

W2(i+D(i ))

D(i )

26 of 45

Combinatorial optimization with unary and binary terms

Quadratic pseudo-Boolean

function optimization

Binary variables

 

27 of 45

Generalization to integer variables

  • n integer variables in 0..K-1
  • nK binary variables (Darbon, 2009)
  • x =0 if x≤k and 1 otherwise

k

28 of 45

Quadratic integer function optimization

Submodular case

Min-cut max-flow problems

(Boros & Hammer, 2002)

Otherwise

NP hard

Efficient exact algorithms

(Ford & Fulkerson ‘56)

(Goldberg & Tarjan ‘88)

(Boykov & Kolgomorov ’04)

29 of 45

Quadratic integer function optimization

For example:

with g convex (Ishikawa ‘03)

Min-cut max-flow problems

(Boros & Hammer, 2002)

Otherwise

NP hard

Efficient exact algorithms

(Ford & Fulkerson ‘56)

(Goldberg & Tarjan ‘88)

(Boykov & Kolgomorov ’04)

30 of 45

Quadratic pseudo-Boolean function optimization

For example:

with g convex (Ishikawa ‘03)

Min-cut max-flow problems

(Boros & Hammer, 2002)

Otherwise

NP hard

Efficient

approximate

algorithms

(Boykov et al.’01)

31 of 45

Combinatorial optimization:

  • Submodularity is “too restrictive” for

certain stereo settings (use non-convex g for example)

  • Use iterative approximate solutions

such as alpha expansion (Boykov et al.

2001)

32 of 45

Graph cuts

Ground truth

For the latest and greatest: http://www.middlebury.edu/stereo

Y. Boykov, O. Veksler and R. Zabih, “Fast Approximate Energy

Minimization via Graph Cuts, PAMI 2001.

Results

33 of 45

More Views (Okutami and Kanade, 1993)

Pick a reference image, and slide the corresponding

window along the corresponding epipolar lines of all

other images, using inverse depth relative to the first

image as the search parameter.

Use the sum of correlation scores to rank matches.

Reprinted from “A Multiple-Baseline Stereo System,” by M. Okutami and T. Kanade, IEEE Trans. on Pattern

Analysis and Machine Intelligence, 15(4):353-363 (1993). \copyright 1993 IEEE.

34 of 45

I1

I2

I10

Reprinted from “A Multiple-Baseline Stereo System,” by M. Okutami and T. Kanade, IEEE Trans. on Pattern

Analysis and Machine Intelligence, 15(4):353-363 (1993). \copyright 1993 IEEE.

35 of 45

Structure from motion

  • Problem statement
  • Ambiguities
  • Euclidean SFM
  • Affine SFM

36 of 45

The Euclidean (perspective) Structure-from-Motion Problem

Given m (internally) calibrated perspective images of n fixed

points Pj we can write

Problem: estimate the m 3x4 matrices Mi = [Ri ti] and

the n positions Pj from the mn correspondences pij .

2mn equations in 11m (or rather 5m)+3n unknowns

Overconstrained problem, that can be solved

using (non-linear) least squares!

(Normalized coordinates)

37 of 45

 

38 of 45

The Euclidean Ambiguity of Euclidean SFM

If Ri, ti, and Pj are solutions,

So are Ri’, ti’, and Pj’, where

In fact, the absolute scale cannot be recovered since:

When the intrinsic parameters are known (normalized coordinates)

Euclidean ambiguity up to a similarity transformation.

39 of 45

Euclidean motion from E (Longuet-Higgins, 1981)

 

40 of 45

Singular Value Decomposition

square roots of

41 of 45

Euclidean motion from E (Longuet-Higgins, 1981)

  • Given F computed from n > 7 point correspondences, and its

SVD F= UWVT, compute E=U diag(1,1,0) VT.

42 of 45

Euclidean motion from E (Longuet-Higgins, 1981)

 

43 of 45

Euclidean motion from E (Longuet-Higgins, 1981)

 

44 of 45

Euclidean motion from E (Longuet-Higgins, 1981)

 

45 of 45

Euclidean reconstruction. Mean relative error: 3.1%