function contrastStretching()

% Read the image as a gray-scale matrix
I = rgb2gray(imread('landsat.jpg'));

mi = double(min(I(:)));
ma = double(max(I(:)));

% Generate the "stretched" (in contrast) image
J = 255*(double(I) - mi)/(ma - mi);

subplot(1,2,1); imshow(I); title('Original image');
subplot(1,2,2); imshow(J, []); title('"Stretched" image');
set(gcf, 'color', 'w');

end