13.2 Stereo Matching16385/s17/Slides/13.2_Stereo_Matching.pdf · Stereo matching as … Energy...

26
Stereo Matching 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University

Transcript of 13.2 Stereo Matching16385/s17/Slides/13.2_Stereo_Matching.pdf · Stereo matching as … Energy...

Page 1: 13.2 Stereo Matching16385/s17/Slides/13.2_Stereo_Matching.pdf · Stereo matching as … Energy Minimization What defines a good stereo correspondence? 1. Match quality – Want each

Stereo Matching16-385 Computer Vision (Kris Kitani)

Carnegie Mellon University

Page 2: 13.2 Stereo Matching16385/s17/Slides/13.2_Stereo_Matching.pdf · Stereo matching as … Energy Minimization What defines a good stereo correspondence? 1. Match quality – Want each

Recall: Stereo Rectification

Reproject image planes onto a common plane parallel to the line between camera centers

What is stereo rectification?

Page 3: 13.2 Stereo Matching16385/s17/Slides/13.2_Stereo_Matching.pdf · Stereo matching as … Energy Minimization What defines a good stereo correspondence? 1. Match quality – Want each

What can we do after rectification?

Page 4: 13.2 Stereo Matching16385/s17/Slides/13.2_Stereo_Matching.pdf · Stereo matching as … Energy Minimization What defines a good stereo correspondence? 1. Match quality – Want each

Depth Estimation via Stereo Matching

Page 5: 13.2 Stereo Matching16385/s17/Slides/13.2_Stereo_Matching.pdf · Stereo matching as … Energy Minimization What defines a good stereo correspondence? 1. Match quality – Want each
Page 6: 13.2 Stereo Matching16385/s17/Slides/13.2_Stereo_Matching.pdf · Stereo matching as … Energy Minimization What defines a good stereo correspondence? 1. Match quality – Want each

1. Rectify images (make epipolar lines horizontal)

2. For each pixel a. Find epipolar line b. Scan line for best match c. Compute depth from disparity

Z =bf

d

Page 7: 13.2 Stereo Matching16385/s17/Slides/13.2_Stereo_Matching.pdf · Stereo matching as … Energy Minimization What defines a good stereo correspondence? 1. Match quality – Want each

Stereo Block Matching

Matching cost

disparity

Left Right

scanline

• Slide a window along the epipolar line and compare contents of that window with the reference window in the left image

• Matching cost: SSD or normalized correlation

Page 8: 13.2 Stereo Matching16385/s17/Slides/13.2_Stereo_Matching.pdf · Stereo matching as … Energy Minimization What defines a good stereo correspondence? 1. Match quality – Want each

SSD

Page 9: 13.2 Stereo Matching16385/s17/Slides/13.2_Stereo_Matching.pdf · Stereo matching as … Energy Minimization What defines a good stereo correspondence? 1. Match quality – Want each

Normalized cross-correlation

Page 10: 13.2 Stereo Matching16385/s17/Slides/13.2_Stereo_Matching.pdf · Stereo matching as … Energy Minimization What defines a good stereo correspondence? 1. Match quality – Want each

Similarity Measure FormulaSum of Absolute Differences (SAD)

Sum of Squared Differences (SSD)

Zero-mean SAD

Locally scaled SAD

Normalized Cross Correlation (NCC)

SAD SSD NCC Ground truth

Page 11: 13.2 Stereo Matching16385/s17/Slides/13.2_Stereo_Matching.pdf · Stereo matching as … Energy Minimization What defines a good stereo correspondence? 1. Match quality – Want each

Effect of window size

W = 3 W = 20

Page 12: 13.2 Stereo Matching16385/s17/Slides/13.2_Stereo_Matching.pdf · Stereo matching as … Energy Minimization What defines a good stereo correspondence? 1. Match quality – Want each

Effect of window size

W = 3 W = 20

Smaller window+ More detail - More noise

Larger window+ Smoother disparity maps - Less detail - Fails near boundaries

Page 13: 13.2 Stereo Matching16385/s17/Slides/13.2_Stereo_Matching.pdf · Stereo matching as … Energy Minimization What defines a good stereo correspondence? 1. Match quality – Want each

When will stereo block matching fail?

Page 14: 13.2 Stereo Matching16385/s17/Slides/13.2_Stereo_Matching.pdf · Stereo matching as … Energy Minimization What defines a good stereo correspondence? 1. Match quality – Want each

When will stereo block matching fail?

textureless regions repeated patterns

specularities

Page 15: 13.2 Stereo Matching16385/s17/Slides/13.2_Stereo_Matching.pdf · Stereo matching as … Energy Minimization What defines a good stereo correspondence? 1. Match quality – Want each

Improving Stereo Block Matching

Page 16: 13.2 Stereo Matching16385/s17/Slides/13.2_Stereo_Matching.pdf · Stereo matching as … Energy Minimization What defines a good stereo correspondence? 1. Match quality – Want each

Block matching Ground truth

What are some problems with the result?

Page 17: 13.2 Stereo Matching16385/s17/Slides/13.2_Stereo_Matching.pdf · Stereo matching as … Energy Minimization What defines a good stereo correspondence? 1. Match quality – Want each

How can we improve depth estimation?

Page 18: 13.2 Stereo Matching16385/s17/Slides/13.2_Stereo_Matching.pdf · Stereo matching as … Energy Minimization What defines a good stereo correspondence? 1. Match quality – Want each

How can we improve depth estimation?Too many discontinuities.

We expect disparity values to change slowly.

Let’s make an assumption: depth should change smoothly

Page 19: 13.2 Stereo Matching16385/s17/Slides/13.2_Stereo_Matching.pdf · Stereo matching as … Energy Minimization What defines a good stereo correspondence? 1. Match quality – Want each

Stereo matching as … Energy Minimization

What defines a good stereo correspondence? 1. Match quality

– Want each pixel to find a good match in the other image 2. Smoothness

– If two pixels are adjacent, they should (usually) move about the same amount

Page 20: 13.2 Stereo Matching16385/s17/Slides/13.2_Stereo_Matching.pdf · Stereo matching as … Energy Minimization What defines a good stereo correspondence? 1. Match quality – Want each

{ {data term smoothness term

energy function (for one pixel)

Page 21: 13.2 Stereo Matching16385/s17/Slides/13.2_Stereo_Matching.pdf · Stereo matching as … Energy Minimization What defines a good stereo correspondence? 1. Match quality – Want each

{ {(block matching result) (smoothness function)

Want each pixel to find a good match in the other image

Adjacent pixels should (usually) move about the same amount

data term smoothness term

energy function (for one pixel)

Page 22: 13.2 Stereo Matching16385/s17/Slides/13.2_Stereo_Matching.pdf · Stereo matching as … Energy Minimization What defines a good stereo correspondence? 1. Match quality – Want each

SSD distance between windows centered at I(x, y) and J(x+ d(x,y), y)

data term

Page 23: 13.2 Stereo Matching16385/s17/Slides/13.2_Stereo_Matching.pdf · Stereo matching as … Energy Minimization What defines a good stereo correspondence? 1. Match quality – Want each

4-­‐connected  neighborhood

8-­‐connected  neighborhood

: set of neighboring pixels

SSD distance between windows centered at I(x, y) and J(x+ d(x,y), y)

smoothness term

Page 24: 13.2 Stereo Matching16385/s17/Slides/13.2_Stereo_Matching.pdf · Stereo matching as … Energy Minimization What defines a good stereo correspondence? 1. Match quality – Want each

“Potts model”

L1 distance

smoothness term

Page 25: 13.2 Stereo Matching16385/s17/Slides/13.2_Stereo_Matching.pdf · Stereo matching as … Energy Minimization What defines a good stereo correspondence? 1. Match quality – Want each

Dynamic Programming

Can minimize this independently per scanline using dynamic programming (DP)

: minimum cost of solution such that d(x,y) = d

Page 26: 13.2 Stereo Matching16385/s17/Slides/13.2_Stereo_Matching.pdf · Stereo matching as … Energy Minimization What defines a good stereo correspondence? 1. Match quality – Want each

Match only Match & smoothness (via graph cut)

Ground Truth

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