Computer Vision I -
Algorithms and Applications:
Dense Correspondence Fields
Carsten Rother
Roadmap this lecture
• Define the Problem
• Discrete Matching – “the standard approach”
• Continuous Matching – “more accurate but more challenging ”
• Depth Map Fusion – ICP (Iterative Closest Point)
02/25/2022 Computer Vision I: Dense Correspondence Fields 2
Roadmap this lecture
• Define the Problem
• Discrete Matching – “the standard approach”
• Continuous Matching – “more accurate but more challenging ”
• Depth Map Fusion – ICP (Iterative Closest Point)
Two Images of a Static Scene
02/25/2022 Computer Vision I: Dense Correspondence Fields 4
Epipolar lines for 1D
correspondence search
Simplification
Move epipoles to infinity
Rectification -
Correspondences are now in same scanline
epipol
epipol
Correspondence Search now in 1D
02/25/2022 Computer Vision I: Dense Correspondence Fields 6
Stereo Camera
disparity
disparity
Depth and Disparity
02/25/2022 Computer Vision I: Dense Correspondence Fields 8
Depth
Depth and Disparity
Depth changes
non- uniformly Depth
Left image
��������� �
infinity
Disparity Range
02/25/2022 Computer Vision I: Dense Correspondence Fields 10
Disparity Range can be quite different across the image
Moving Scene
Optical flow: 2D movement Scene Flow: 3D movement
2D output
(x,y) movement
3D output (x,y,z) movement (hard to visualize)
Often scene flow is done with RGBD input
We will look at a method later (patch match) which
can deal with all these cases.
Optical Flow: Small versus large baseline
02/25/2022 Computer Vision I: Dense Correspondence Fields 12
Tiny displacement (slow moving object in a video sequence)
Normal/large displacement (fast moving object in a video sequence;
stereo camera)
Very large displacement
Often: Different set of techniques used such as
continuous domain and label
Roadmap this lecture
• Define the Problem
• Discrete Matching – “the standard approach”
• Continuous Matching – “more accurate but more challenging ”
• Depth Map Fusion – ICP (Iterative Closest Point)
Depth Map – discrete Formulation
02/25/2022 Computer Vision I: Dense Correspondence Fields 14
• Each pixel gets a disparity label
• Edges are used later for constraining the labeling of neighboring pixels
��=0
��=����
��=1
Similarity measures (photo consistency measures)
• Pixel-Cost for a pixel
Left: Right:
• Patch-Cost for a pixel
Left: Right:
To use neighborhood is same motivation as for sparse point matching (lecture 5)
Size of patches often to
Robust similarity measures
• Robust to changes in brightness (offset and scaling)
(known as NCC – Normalized cross correlation)
02/25/2022 Computer Vision I: Dense Correspondence Fields 16
�
�( �
�) =
� ∈ �
∑
�( �
��− �
�) ( �
�−���
− �
�)
√ ∑
� ∈ ��
( �
��
− �
�)
2√ ∑
� ∈ ��
( �
�−���
− �
�)
2Mean Image: where is the number of pixels in left image -
-
- -
-
Many different similarity measures.
See details in:
D. Scharstein and R. Szeliski. A taxonomy and evaluation of dense two-frame stereo correspondence algorithms.
International Journal of Computer Vision, 47(1/2/3):7-42, April-June 2002
Block matching
Find for each pixel the optimal depth independently
Block Matching
• is very simple
• is very efficient (thanks to the integral image approach!)
• can be easily parallelized
• can serve as a reasonable initialization for more elaborated techniques
02/25/2022 Computer Vision I: Dense Correspondence Fields 18
Block matching: left-right consistency check
1. Match left to right and right to left .
2. Red pixels: Going from left to right and back is a different pixel location:
3. Fill red pixels in (e.g. from neighbors)
Block Matching l-r check
Original (left) Inpainted
Limitations and ambiguities
02/25/2022 Computer Vision I: Dense Correspondence Fields 20
Problem: Similarity constraint is too local
Block Matching:
Non-local constraint needed!
Tsukuba Scene
Ground Truth
Smoothness constraint
02/25/2022 Computer Vision I: Dense Correspondence Fields 22
Neighbouring pixel have similar disparity
Block Matching Ground Truth
Uniqueness constraint
For any point in one image, there should be at most one matching point in the other image
Left Image Right Image
disparity = 5 disparity = 6
Physically not
possible to see
both 3D points
Introduce the concept of occlusion
02/25/2022 Computer Vision I: Dense Correspondence Fields 24
Left image right image
matched all pixels matched
occluded
matched
Introduce an extra label with cost : matched or not matched
Ordering Constraints
left
right object
a b c
b c a
left
right object
a b c
c
b a
Holds in “normal”
situations
Doesn’t hold in presence
of thin objects
Scanline-based approaches
02/25/2022 Computer Vision I: Dense Correspondence Fields 26
Enforce these constraints for each scanline independently
Shortest Path Algorithm
Pre-compute all matching costs! So called “cost volume”
(the matching cost: ) disparity
R ig h t Im ag e
Left Image 1
n
1 n
Left occlusion
Right occlusion
Example
02/25/2022 Computer Vision I: Dense Correspondence Fields 28
Left image right image
matched matched
At infinity
R ig h t Im ag e
Left Image 1
1 n
n
disparity
Example
Left image right image
matched all pixels matched
occluded
matched
R ig h t Im ag e
Left Image 1
1 n
n
disparity
Cost Volume Illustration
02/25/2022 Computer Vision I: Dense Correspondence Fields 30
Red path is the optimal shortst path
zoom Dark pixels have low
matching score
Shortest Path Algorithm
Creates streaking artefacts Ground Truth
Block Matching
Extension to 2D Grid
02/25/2022 Computer Vision I: Dense Correspondence Fields 32
• Do all of the above constraints but on a 2D grid.
• Inference is much harder and no longer optimal (stay tuned for Computer Vision 2)
[see inference details in Kolmogorov, Rother ECCV 06]
More complex regularizations – Surface Stereo
Computed disparity maps
Assignment of pixels to surfaces
Assumption: Describe the scene by a few low-degree surfaces (splines, planes)
More complex regularizations – Object Stereo
02/25/2022 Computer Vision I: Dense Correspondence Fields 34 reference plane +
parallax
Assumption:
Describe scene by a few Objects:
- compact in 3D - Connected in 3D - each object has a
compact color model
Depth d
Objects o
[Bleyer, Rother,Rhemann,Gelautz]More complex regularizations – Scene Stereo
Left input
image Object labelling
proposal 1
Object labelling proposal 2
Assumption: Describe scene by a few Objects which are physically plausible:
- objects do not fly in the air
- objects do not intersect each other
Roadmap this lecture
• Define the Problem
• Discrete Matching – “the standard approach”
• Continuous Matching – “more accurate but more challenging ”
• Depth Map Fusion – ICP (Iterative Closest Point)
02/25/2022 Computer Vision I: Dense Correspondence Fields 36
Halfway slide
3 minutes break
Patch Match Stereo
02/25/2022 Computer Vision I: Dense Correspondence Fields 38
Left view Right view
[Bleyer, Rhemann, Rother, BMVC ’11]
Goal: Depth Map
Depth map
Window-based Matching
02/25/2022 Computer Vision I: Dense Correspondence Fields 40
Local stereo matching:
rectangular region (patch) check photo-consistency
Window-based Matching
Local stereo matching:
Problems - Window-based Matching
02/25/2022 Computer Vision I: Dense Correspondence Fields 42
Fails at discontinuities
Fails at non-fronto-parallel planes
No continuous depth label
Slow
Discontinuities
Discontinuities
02/25/2022 Computer Vision I: Dense Correspondence Fields 44
Adaptive support weights [Yoon, CVPR ‘05]
Problems
Fails at discontinuities
Fails at non-fronto-parallel planes
No continuous depth label
Slow
Non-front to parallel planes
02/25/2022 Computer Vision I: Dense Correspondence Fields 46
Non-front to parallel planes
The importance of 3D search space
02/25/2022 Computer Vision I: Dense Correspondence Fields 48
Problems
Fails at discontinuities
Fails at non-fronto-parallel planes
No continuous depth label
Slow
Let’s try something
02/25/2022 Computer Vision I: Dense Correspondence Fields 50
Random Correspondence
Depth map
Note we only visualize 1
out of 3 parameters
Sampling
02/25/2022 Computer Vision I: Dense Correspondence Fields 52
Depth map
(takes solution if better, not proper sampling)
0 Max
depth Current
depth
Sample in limited
range of orientation
Sampling
Depth map
(takes solution if better,
Lets try a different type of “sampling”
02/25/2022 Computer Vision I: Dense Correspondence Fields 54
Depth map
Sample your neighbours ;-)
Depth map
(takes solution from your 4 neighbors if
better, not proper sampling)
Sample your neighbours ;-)
02/25/2022 Computer Vision I: Dense Correspondence Fields 56
Depth map
Sample your neighbours ;-)
Depth map
Sample your neighbours ;-)
02/25/2022 Computer Vision I: Dense Correspondence Fields 58
Depth map
Sample your neighbours ;-)
Depth map
Patch Match Stereo Algorithm
02/25/2022 Computer Vision I: Dense Correspondence Fields 60
1. Random initialization
2. Go through pixel in sequential order:
2a. Look at solutions from left/top neighbour 2b. sample around current solution
Left image – Reindeer
(Middlebury) Left and right disparity maps (intermediate step of iteration 1)
Patch Match Stereo Algorithm
Why does it work so well?
02/25/2022 Computer Vision I: Dense Correspondence Fields 62
Left image – Sawtooth (Middlebury)
Image consists of 3 planes -
~80.000 guesses for yellow plane Ground truth disparities
Randomization is in our favour
No cost volume needed:
well suited for large images and large depth range
The local sampling is important to get fine details
and escape local minima
Patch Match Stereo Algorithm
• If you run it forever it gives the globally optimal
• If you stop after finite time then the result has implicit smoothness (which is even what you want)!
• The method is a mix of message passing and simplified and
extended Gibbs sampling (stay tuned for Computer Vision 2)
Advertisement: 6D Flow
02/25/2022 Computer Vision I: Dense Correspondence Fields 65
6D Scene Flow: rotation and translation
6D movement Input: Kinect Image
Thursday 20.12 11.00 Michael Hornacek, room INF-2024
6D output
(hard to visualize)
PatchMatch (the first publication)
Patch Match: A Dense 2D nearest Neighbor Search
02/25/2022 Computer Vision I: Dense Correspondence Fields67
Hole Filling (only skteched!)
Hole
(a) Get initial solution with some method User input
(b) Find patches for hole in the outside image
(c) Update hole patches and iterate: (b-c; or a-c) (b) The found 2D flow
We look in the same image
and encode label as 2D offset
Roadmap this lecture
• Define the Problem
• Discrete Matching – “the standard approach”
• Continuous Matching – “harder but better”
• Depth Map Fusion – ICP (Iterative Closest Point)
KinectFusion - overview
02/25/2022 Computer Vision I: Multi-View 3D reconstruction 69
Camera tracking
?
Picture of real red camera
Picture of virtual blue camera
(raycasting)
Goal: Find red camera position by moving blue virtual camera in such a way that the virtual and real picture are the same.
Known position virtual camera
unknown position Real camera
Iterative Closest Point - ICP
Given e.g. a depth image from two view points:
how to align the two point sets?
02/25/2022 Computer vision : ICP 71
applied e.g. in:
Shape inspection, Motion estimation, Appearance analysis, Texture Mapping, Tracking, …
Chen, Y. and Medioni, G. “Object Modeling by Registration of Multiple Range Images,” Proc. IEEE Conf. on Robotics and Automation, 1991
Iterative Closest Point - ICP
Basic algorithm:
1. Determine pairs of corresponding points
2. Estimate a transformation that minimizes the distances between the correspondences
3. Apply the transformation to align input and target.
4. Go back to 1.
Iterative Closest Point - ICP
We have two point sets
We are looking for mapping, e.g. a rotation R and translation t.
optimization problem:
Weightings wi,j encode point correspondences:
wi,j = 1 (corresponding points) wi,j = 0 (otherwise)
Correspondences are from Neighbour Search.
02/25/2022 Computer vision : ICP 73
see a closed form solution to
this problem in Szeliski page 277
Iterative Closest Point - ICP
Starting from the basic idea there are a lot of variants.
Variants on the following stages of ICP have been proposed:
1.Selecting source points (from one or both point sets) 2.Choose an error metric
3.Matching to points in the other mesh 4.Weighting the correspondences
5.Rejecting certain (outlier) point pairs
6.Minimizing the error metric
Iterative Closest Point - ICP
Selecting source points:
• Use all points
• Uniform subsampling
• Random sampling
• Normal-space sampling
• Ensure that samples have normals distributed as uniformly as possible
02/25/2022 Computer vision : ICP 75
Uniform Sampling
Uniform Sampling Normal-Space Sampling Normal-Space Sampling
Iterative Closest Point - ICP
Choose an error metric
Point-to-Plane Error Metric:
• Using point-to-plane distance instead of point-to-point lets flat
regions slide along each other
Iterative Closest Point - ICP
Matching :
Matching strategy has greatest effect on convergence and speed
• Closest point (stable, but slow and requires preprocessing)
02/25/2022 Computer vision : ICP 77
Iterative Closest Point - ICP
Matching :
Matching strategy has greatest effect on convergence and speed
• Closest point (stable, but slow and requires preprocessing)
• Normal shooting (better for smooth clouds)
Iterative Closest Point - ICP
Matching :
Matching strategy has greatest effect on convergence and speed
• Closest point (stable, but slow and requires preprocessing)
• Normal shooting (better for smooth clouds)
• Closest compatible point (stable, slow and requires preprocessing)
• Can improve effectiveness
• Compatibility based on normals, colors, etc.
• At limit, degenerates to feature matching
02/25/2022 Computer vision : ICP 79
Iterative Closest Point - ICP
Matching :
Matching strategy has greatest effect on convergence and speed
• Closest point (stable, but slow and requires preprocessing)
• Normal shooting (better for smooth clouds)
• Closest compatible point (stable, slow and requires preprocessing)
• Can improve effectiveness
• Compatibility based on normals, colors, etc.
• At limit, degenerates to feature matching
• Projection
• finding closest point is most expensive stage
• use a simpler algorithm to find correspondences
• for range images, can simply project points
• one to two orders of magnitude faster
Most important slide
02/25/2022 Computer Vision I: Dense Correspondence Fields 81