Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2...

110
Multi-View Geometry: Find Corresponding Points (New book: Ch7.4, 7.5, 7.6 Old book: 11.3-11.5) Credit for materials: Trevor Darrell, Berkeley, C280, Marc Pollefeys, UNC/ETH-Z, CS6320 S012, Andrew Zisserman, MVG Book Guido Gerig CS 6320 Spring 2013

Transcript of Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2...

Page 1: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Multi-View Geometry: Find Corresponding Points

(New book: Ch7.4, 7.5, 7.6 Old book: 11.3-11.5)

Credit for materials: Trevor Darrell, Berkeley, C280, Marc Pollefeys, UNC/ETH-Z, CS6320 S012, Andrew Zisserman, MVG Book

Guido Gerig CS 6320 Spring 2013

Page 2: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Excellent Website: http://vision.middlebury.edu/stereo/

Page 3: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Stereo reconstruction: main steps

– Calibrate cameras – Rectify images – Compute disparity – Estimate depth

Grauman

Page 4: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Stereo reconstruction: main steps

– Calibrate cameras – Rectify images – Compute disparity – Estimate depth

Grauman

Page 5: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Correspondence problem

Multiple match hypotheses satisfy epipolar constraint, but which is correct?

Figure from Gee & Cipolla 1999 Grauman

Page 6: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Correspondence problem • Beyond the hard constraint of epipolar geometry,

there are “soft” constraints to help identify corresponding points – Similarity – Uniqueness – Ordering – Disparity gradient

Grauman

Page 7: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Correspondence problem • Beyond the hard constraint of epipolar geometry,

there are “soft” constraints to help identify corresponding points – Similarity – Uniqueness – Ordering – Disparity gradient

• To find matches in the image pair, we will assume

– Most scene points visible from both views – Image regions for the matches are similar in appearance

Grauman

Page 8: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Your basic stereo algorithm

Adapted from Li Zhang Grauman

Page 9: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Your basic stereo algorithm

For each epipolar line:

Adapted from Li Zhang Grauman

Page 10: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Your basic stereo algorithm

For each epipolar line: For each pixel in the left image

Adapted from Li Zhang Grauman

Page 11: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Your basic stereo algorithm

For each epipolar line: For each pixel in the left image

• compare with every pixel on same epipolar line in right image

Adapted from Li Zhang Grauman

Page 12: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Your basic stereo algorithm

For each epipolar line: For each pixel in the left image

• compare with every pixel on same epipolar line in right image • pick pixel with minimum match cost

Adapted from Li Zhang Grauman

Page 13: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Your basic stereo algorithm

For each epipolar line: For each pixel in the left image

• compare with every pixel on same epipolar line in right image • pick pixel with minimum match cost

Adapted from Li Zhang Grauman

Page 14: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Your basic stereo algorithm

For each epipolar line: For each pixel in the left image

• compare with every pixel on same epipolar line in right image • pick pixel with minimum match cost Improvement: match windows

• This should look familiar... • E.g. SSD, correlation etc.

Adapted from Li Zhang Grauman

Page 15: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Stereo matching

• Search is limited to epipolar line (1D) • Look for “most similar pixel”

?

Page 16: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Stereo matching algorithms • Match Pixels in Conjugate Epipolar Lines

– Assume brightness constancy – This is a tough problem – Numerous approaches

• dynamic programming [Baker 81,Ohta 85] • smoothness functionals • more images (trinocular, N-ocular) [Okutomi

93] • graph cuts [Boykov 00]

– A good survey and evaluation: – http://vision.middlebury.edu/stereo/

Page 17: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Correspondence using Discrete Search

Page 18: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Compare intensities pixel-by-pixel

Comparing image regions

I(x,y) I´(x,y)

Census

Similarity measures

125 126 125

127 128 130

129 132 135

0 0 0

0 1

1 1 1

(Real-time chip from TYZX based on Census)

only compare bit signature

Page 19: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Sum of Squared Differences (SSD)

Page 20: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Example

Page 21: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Example ctd

Page 22: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Example image pair – parallel cameras

Page 23: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

First image

Page 24: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Second image

Page 25: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Intensity profiles

• Clear correspondence between intensities, but also noise and ambiguity

Page 26: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Dense correspondence algorithm Parallel camera example – epipolar lines are corresponding rasters

Page 27: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Dense correspondence algorithm Parallel camera example – epipolar lines are corresponding rasters

Page 28: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Dense correspondence algorithm Parallel camera example – epipolar lines are corresponding rasters

epipolar line

Page 29: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Dense correspondence algorithm

Search problem (geometric constraint): for each point in the left image, the corresponding point in the right image lies on the epipolar line (1D ambiguity)

Disambiguating assumption (photometric constraint): the intensity neighbourhood of corresponding points are similar across images

Measure similarity of neighbourhood intensity by cross-correlation

Parallel camera example – epipolar lines are corresponding rasters

epipolar line

Page 30: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Correspondence problem

Source: Andrew Zisserman

Neighborhood of corresponding points are similar in intensity patterns.

Page 31: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Correlation Methods (1970--) F&P book new: 7.4, old 11.3

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

Page 32: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Correlation Methods (1970--) F&P book new: 7.4, old 11.3

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

Page 33: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Correlation Methods (1970--) F&P book new: 7.4, old 11.3

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

Page 34: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Correlation Methods (1970--) F&P book new: 7.4, old 11.3

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

Page 35: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Correlation Methods (1970--) F&P book new: 7.4, old 11.3

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

Page 36: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Correlation Methods (1970--) F&P book new: 7.4, old 11.3

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

Page 37: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Correlation Methods (1970--) F&P book new: 7.4, old 11.3

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

Page 38: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Correlation Methods (1970--) F&P book new: 7.4, old 11.3

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

Page 39: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Correlation Methods (1970--) F&P book new: 7.4, old 11.3

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

Page 40: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Correlation Methods (1970--) F&P book new: 7.4, old 11.3

Normalized Correlation: minimize q instead.

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

Page 41: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Correlation Methods (1970--) F&P book new: 7.4, old 11.3

Normalized Correlation: minimize q instead.

Slide the window along the epipolar line until w.w’ is maximized. 2 Minimize |w-w’|.

Page 42: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Cross-correlation of neighbourhood regions

• left and right windows encoded as vectors w and w’ • zero-mean vectors (𝑤 − 𝑤�) and (𝑤′ − 𝑤� ’) • Normalized cross-correlation:

• Advantage: Invariant to intensity differences: Invariant to affine intensity transformation 𝐼′ = 𝛼𝐼 + 𝜇

Page 43: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Cross-correlation of neighbourhood regions

epipolar line

• left and right windows encoded as vectors w and w’ • zero-mean vectors (𝑤 − 𝑤�) and (𝑤′ − 𝑤� ’) • Normalized cross-correlation:

• Advantage: Invariant to intensity differences: Invariant to affine intensity transformation 𝐼′ = 𝛼𝐼 + 𝜇

Page 44: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Cross-correlation of neighbourhood regions

epipolar line

• left and right windows encoded as vectors w and w’ • zero-mean vectors (𝑤 − 𝑤�) and (𝑤′ − 𝑤� ’) • Normalized cross-correlation:

• Advantage: Invariant to intensity differences: Invariant to affine intensity transformation 𝐼′ = 𝛼𝐼 + 𝜇

Page 45: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Cross-correlation of neighbourhood regions

epipolar line

• left and right windows encoded as vectors w and w’ • zero-mean vectors (𝑤 − 𝑤�) and (𝑤′ − 𝑤� ’) • Normalized cross-correlation:

• Advantage: Invariant to intensity differences: Invariant to affine intensity transformation 𝐼′ = 𝛼𝐼 + 𝜇

Page 46: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Cross-correlation of neighbourhood regions

epipolar line

• left and right windows encoded as vectors w and w’ • zero-mean vectors (𝑤 − 𝑤�) and (𝑤′ − 𝑤� ’) • Normalized cross-correlation:

• Advantage: Invariant to intensity differences: Invariant to affine intensity transformation 𝐼′ = 𝛼𝐼 + 𝜇

Page 47: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Correlation-based window matching

Source: Andrew Zisserman

Page 48: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Correlation-based window matching

Source: Andrew Zisserman

Page 49: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Correlation-based window matching

Source: Andrew Zisserman

Page 50: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Correlation-based window matching

Source: Andrew Zisserman

Page 51: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Correlation-based window matching

Source: Andrew Zisserman

Page 52: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Textureless regions

Source: Andrew Zisserman Grauman

Page 53: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Textureless regions

Source: Andrew Zisserman

Textureless regions are non-distinct; high ambiguity for matches.

Grauman

Page 54: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Textureless regions

Source: Andrew Zisserman

Textureless regions are non-distinct; high ambiguity for matches.

Grauman

Page 55: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Textureless regions

Source: Andrew Zisserman Grauman

Page 56: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Textureless regions

Source: Andrew Zisserman

Textureless regions are non-distinct; high ambiguity for matches, → wrong matches

Grauman

Page 57: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Effect of window size

Source: Andrew Zisserman Grauman

Page 58: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Effect of window size

Source: Andrew Zisserman Grauman

Page 59: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Effect of window size

Source: Andrew Zisserman Grauman

Page 60: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Problems with window matching

Page 61: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Effect of window size

Figures from Li Zhang

Want window large enough to have sufficient intensity variation, yet small enough to contain only pixels with about the same disparity.

Grauman

Page 62: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Effect of window size

W = 3 W = 20

Figures from Li Zhang

Want window large enough to have sufficient intensity variation, yet small enough to contain only pixels with about the same disparity.

Grauman

Page 63: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Problems?

• Ordering • Occlusion • Foreshortening

Solutions: • Formulate Constraints • Use more than two views • Smart solutions vs. “brute force” searches with

statistics

Page 64: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Exploiting scene constraints

Page 65: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Additional geometric constraints for correspondence

[Faugeras, pp. 321]

• Ordering of points: Continuous surface: same order in both images.

• Is that always true?

A B C A B C

A B C

A B C

Page 66: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

The Ordering Constraint

In general the points are in the same order on both epipolar lines.

Page 67: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

The Ordering Constraint

But it is not always the case..

Page 68: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Ordering constraint

1 2 3 4,5 6 1 2,3 4 5 6

2 1 3 4,5 6 1

2,3

4

5

6

surface slice surface as a path

occlusion right

occlusion left

Page 69: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Stereo matching

Similarity measure (SSD or NCC)

Constraints • epipolar • ordering • uniqueness • disparity limit

Trade-off • Matching cost (data) • Discontinuities (prior)

Consider all paths that satisfy the constraints

pick best using dynamic programming

Page 70: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Stereo matching

Optimal path (dynamic programming )

Similarity measure (SSD or NCC)

Constraints • epipolar • ordering • uniqueness • disparity limit

Trade-off • Matching cost (data) • Discontinuities (prior)

Consider all paths that satisfy the constraints

pick best using dynamic programming

Page 71: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Dynamic Programming (Baker and Binford, 1981)

Find the minimum-cost path going monotonically down and right from the top-left corner of the graph to its bottom-right corner. • Nodes = matched feature points (e.g., edge points). • Arcs = matched intervals along the epipolar lines. • Arc cost = discrepancy between intervals.

Page 72: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Dynamic Programming (Baker and Binford, 1981)

Find the minimum-cost path going monotonically down and right from the top-left corner of the graph to its bottom-right corner. • Nodes = matched feature points (e.g., edge points). • Arcs = matched intervals along the epipolar lines. • Arc cost = discrepancy between intervals.

Page 73: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Dynamic Programming (Baker and Binford, 1981)

Find the minimum-cost path going monotonically down and right from the top-left corner of the graph to its bottom-right corner. • Nodes = matched feature points (e.g., edge points). • Arcs = matched intervals along the epipolar lines. • Arc cost = discrepancy between intervals.

Page 74: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Dynamic Programming (Baker and Binford, 1981)

Find the minimum-cost path going monotonically down and right from the top-left corner of the graph to its bottom-right corner. • Nodes = matched feature points (e.g., edge points). • Arcs = matched intervals along the epipolar lines. • Arc cost = discrepancy between intervals.

Page 75: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Dynamic Programming (Baker and Binford, 1981)

Find the minimum-cost path going monotonically down and right from the top-left corner of the graph to its bottom-right corner. • Nodes = matched feature points (e.g., edge points). • Arcs = matched intervals along the epipolar lines. • Arc cost = discrepancy between intervals.

Page 76: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Dynamic Programming (Baker and Binford, 1981)

Find the minimum-cost path going monotonically down and right from the top-left corner of the graph to its bottom-right corner. • Nodes = matched feature points (e.g., edge points). • Arcs = matched intervals along the epipolar lines. • Arc cost = discrepancy between intervals.

Page 77: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

The Ordering Constraint

In general the points are in the same order on both epipolar lines.

Page 78: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

The Ordering Constraint

But it is not always the case..

Page 79: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Forbidden Zone

m1 m2

M

Page 80: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Forbidden Zone

m1 m2

M

N

n1 n2

Page 81: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Forbidden Zone of M:

Violation of ordering constraints

Forbidden Zone

m1 m2

M

N

n1 n2

Page 82: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Forbidden Zone of M:

Violation of ordering constraints

Forbidden Zone

m1 m2

M

N

n1 n2

Practical applications: – Object bulges out: ok – In general: ordering across

whole image is not reliable feature

– Use ordering constraints for neighbors of M within small neighborhood only

Page 83: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Disparity map

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

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

Page 84: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Hierarchical stereo matching D

owns

ampl

ing

(G

auss

ian

pyra

mid

)

Dis

pari

ty p

ropa

gati

on

Allows faster computation

Deals with large disparity ranges

Page 85: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Dynamic Programming (Ohta and Kanade, 1985)

Reprinted from “Stereo by Intra- and Intet-Scanline Search,” by Y. Ohta and T. Kanade, IEEE Trans. on Pattern Analysis and Machine Intelligence, 7(2):139-154 (1985). Ó 1985 IEEE.

Page 86: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Real-time stereo on graphics hardware

• Computes Sum-of-Square-Differences • Hardware mip-map generation used to aggregate results over

support region • Trade-off between small and large support window

Ruigang Yang and Marc Pollefeys, UNC

140M disparity hypothesis/sec on Radeon 9700pro e.g. 512x512x20disparities at 30Hz

Shape of a kernel for summing up 6 levels

Page 87: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Stereo results

Ground truth Scene

– Data from University of Tsukuba – Similar results on other images without ground

truth

Page 88: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering
Page 89: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Results with window correlation

Window-based matching (best window size)

Ground truth

Page 90: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Results with better method

State of the art method Boykov et al., Fast Approximate Energy Minimization via Graph Cuts,

International Conference on Computer Vision, September 1999.

Ground truth

Page 91: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Material I

• http://vision.middlebury.edu/stereo/

• (online stereo pairs and truth (depth maps) • Stereo correspondence software: e.g.

http://vision.middlebury.edu/stereo/data/scenes2001/data/imagehtml/tsukuba.html

• CVonline compendium: http://homepages.inf.ed.ac.uk/rbf/CVonline/

Page 92: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Material II

• Epipolar Geometry, Rectification: • http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/FUSIELLO2/re

ctif_cvol.html • and:

http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/OWENS/LECT11/node11.html

• Stereo: • http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/OWENS/LECT

11/lect11.html • 3D Reconstruction: • http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/OWENS/LECT

11/node8.html

Page 93: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Additional Materials

Page 94: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Problem: Foreshortening

Page 95: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Why is cross-correlation such a poor measure in the second case?

1. The neighbourhood region does not have a “distinctive” spatial intensity distribution

2. Foreshortening effects

Page 96: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Why is cross-correlation such a poor measure in the second case?

1. The neighbourhood region does not have a “distinctive” spatial intensity distribution

2. Foreshortening effects

Page 97: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Why is cross-correlation such a poor measure in the second case?

1. The neighbourhood region does not have a “distinctive” spatial intensity distribution

2. Foreshortening effects

Page 98: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Why is cross-correlation such a poor measure in the second case?

1. The neighbourhood region does not have a “distinctive” spatial intensity distribution

2. Foreshortening effects

fronto-parallel surface imaged length the same

Page 99: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Why is cross-correlation such a poor measure in the second case?

1. The neighbourhood region does not have a “distinctive” spatial intensity distribution

2. Foreshortening effects

fronto-parallel surface imaged length the same

Page 100: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Why is cross-correlation such a poor measure in the second case?

1. The neighbourhood region does not have a “distinctive” spatial intensity distribution

2. Foreshortening effects

fronto-parallel surface imaged length the same

Page 101: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Why is cross-correlation such a poor measure in the second case?

1. The neighbourhood region does not have a “distinctive” spatial intensity distribution

2. Foreshortening effects

fronto-parallel surface imaged length the same

slanting surface imaged lengths differ

Page 102: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Three Views

The third eye can be used for verification..

Demo epipolar geometry

Page 103: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Three Views

The third eye can be used for verification..

Demo epipolar geometry

Page 104: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Three Views

The third eye can be used for verification..

Demo epipolar geometry

Page 105: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

More Views (Okutami and Kanade, 1993)

New book: Ch7.6 p. 215: Pick a reference image, and slide the corresponding window along the corresponding epipolar lines of all other images, using inverse depth (𝑍−1) relative to the first image as the search parameter.

Use the sum of correlation scores to rank matches: SSD used as global evaluation function: Find 𝑍−1 that minimizes SSD.

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.

Page 106: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Multi-camera configurations

Okutami and Kanade

(illustration from Pascal Fua)

Page 107: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

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.

Page 108: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering
Page 109: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Normalized cross correlation

Source: Andrew Zisserman

Page 110: Multi-View Geometry: Find Corresponding Points (New book ...gerig/CS6320-S2013/Materials/CS... · 2 M N n 1 n 2 Practical applications: – Object bulges out: ok – In general: ordering

Aggregation window sizes Small windows • disparities similar • more ambiguities • accurate when correct

Large windows • larger disp. variation • more discriminant • often more robust • use shiftable windows to deal

with discontinuities

(Illustration from Pascal Fua)