L3.2: Disparity map calculation
Calculation of disparity map for pairs of stereo images using calculated intrinsic and extrinsic parameters.Image rectification and disparity range estimation
As it has been said before - the necessary step for stereo calculations is rectification of input images. This can be done using rectifyStereoImages function:
Now you can display mix of left and right images as anaglyph (red-cyan) picture:
Using imtool you can measure disparity (distance) between points that are close to and far from the camera to get the range for disparity.
Calculating disparity map
In Matlab, disparity function is used to calculate disparity map from the two rectified images. There are few parameters to be tuned, mainly the disparity range. For the default parameters shown below, the result is not very nice (a lot of noise and wrong measurements).
Calculating 3D points from disparity map
When disparity map is calculated, you can convert it to full 3D coordinates of points. Based on baseline, focal length and disparity value X, Y and Z is calculated.
Expected results for good parameters