Main Content

Adjust Image Intensity Values to Specified Range

This example shows how to increase the contrast in a low-contrast grayscale image by remapping the data values to fill the entire available intensity range [0, 255].

Read image into the workspace.

I = imread('pout.tif');

Adjust the contrast of the image using imadjust.

J = imadjust(I);

Display the original image and the adjusted image, side-by-side. Note the increased contrast in the adjusted image.

imshowpair(I,J,'montage')

Figure contains an axes. The axes contains an object of type image.

Plot the histogram of the adjust image. Note that the histogram of the adjusted image uses values across the whole range.

figure
subplot(1,2,1)
imhist(I,64)
subplot(1,2,2)
imhist(J,64)

Figure contains 4 axes. Axes 1 contains an object of type stem. Axes 2 contains 2 objects of type image, line. Axes 3 contains an object of type stem. Axes 4 contains 2 objects of type image, line.