Finally, we can begin the stereo correspondences lookup process!
Things are becoming a little bit more complex but do not worry. First, we will describe the power of the BlockMatching application.
The resampling of our images in epipolar geometry allows us to constrain the search along a 1-dimensional line as opposed to both dimensions, but what is even more important is that the disparities along the lines, i.e. the offset along the lines measured by the block-matching process can be directly linked to the local elevation
An almost complete spectrum of stereo correspondence algorithms has been published and it is still augmented at a significant rate! See for example . The Orfeo ToolBox implements different strategies for block matching:
An other important parameter (mandatory in the application!) is the range of disparities. In theory, the block matching can perform a blind exploration and search for a infinite range of disparities between the stereo pair. We need now to evaluate a range of disparities where the block matching will be performed (in the general case from the deepest point on Earth, the Challenger Deep. to the Everest summit!)
We deliberately exaggerated but you can imagine that without a smaller range the block matching algorithm can take a lot of time. That is why these parameters are mandatory for the application and as a consequence we need to estimate them manually. This is pretty simple using the two epipolar images.
In our case, we take one point on a flat area. The image coordinate in image1 is [1970,1525] and in image2 is [1970,1526]. We then select a second point on a higher region (in our case a point near the top of the Pyramid of Cheops!). The image coordinate of this pixel in image1 is [1661,1299] and in image2 is [1633,1300]. So you see for the horizontal exploration, we must set the minimum value lower than −30 (the convention for the sign of the disparity range is from image1 to image2).
Note that this estimation can be simplified using an external DEM in the StereoRectificationGridGenerator application. Regarding the vertical disparity, in the first step we said that we reduced the problem of 3-D extraction to a 1-D problem, but this is not completely true in general cases. There might be small disparities in the vertical direction which are due to parallax errors (i.e. epipolar lines exhibit a small shift in the vertical direction, around 1 pixel). In fact, the exploration is typically smaller along the vertical direction of disparities than along the horizontal one. You can also estimate them on the epipolar pair (in our case we use a range of −1 to 1).
One more time, take care of the sign of this minimum and this maximum for disparities (always from image1 to image2).
The command line for the BlockMatching application is :
The application creates by default a two bands image : the horizontal and vertical disparities.
The BlockMatching application gives access to a lot of other powerful functionalities to improve the quality of the output disparity map.
Here are a few of these functionalities:
Of course all these parameters can be combined to improve the disparity map.