主要内容

将图像强度值调整到指定范围

R2026b

此示例说明如何通过重新映射数据值以填满整个可用强度范围 [0, 255] 来增大低对比度灰度图像的对比度。

将图像读入工作区。

I = imread('pout.tif');

使用 imadjust 调整图像的对比度。

J = imadjust(I);

并排显示原始图像和调整后的图像。注意调整后图像中对比度的增大。

imshowpair(I,J,'montage')

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

绘制调整图像的直方图。请注意调整后图像的直方图使用完整范围内的值。

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

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

另请参阅

|