I1 = imread('scene_left.png');
I2 = imread('scene_right.png');
figure
imshow(stereoAnaglyph(I1,I2));
title('Red-cyan composite view of the stereo images');
disparityRange = [-6 10];
disparityMap = disparity(rgb2gray(I1),rgb2gray(I2),'BlockSize',15,'DisparityRange',disparityRange);
figure
imshow(disparityMap, disparityRange);
title('Disparity Map');
colormap jet
colorbar
disparityRange = [-6 10];
disparityRange = [0 16];
显然,默认disparityRange =