Two-view stereopsis is the problem of finding per-pixel depth given two camera views and their relative pose (
Disparity
First, consider a basic setup where the cameras are facing the same direction and are related by a horizontal translation. That is,
and the difference, called the disparity, is
Intuitively, this says that the farther the object is from the camera (higher
Stereo Rectification
Before we continue to finding
Another way to view this transformation is to make the Epipolar Lines parallel; if this is done, then the epipoles are at infinity, thus making the image planes parallel.
Formally, our transformation will be a rotation
The matrix that satisfies this constraint has its first row be exactly
such that
Thus, the steps of stereo rectification can be summarized as follows:
- Estimate the Essential Matrix
. - Compute the epipole
by solving . - Build
using the procedure above and also compute and from . - Let
and . - Transform the left camera with
and the right camera with .
Finding Correspondences
Now, we will estimate
More specifically, for each patch in the left image, weโll scan along the same
There are multiple choices of similarity functions. For windows
- Sum of squared differences (SSD):
- Sum of absolute differences (SAD):
- Zero-mean normalized cross correlation (ZNCC):
where
Photoconsistency
Note that this stereopsis technique relies on two major assumptions:
- There are few occlusions within the scene. Most features in the world are captured in both views.
- The worldโs surfaces is Lambertian; that is, it reflects the same color into both views (unlike mirrors or shiny surfaces).