我使用了imadjust功能来降低原始图像的对比度。但是,当我为该低对比度图像生成直方图时,我注意到最后一个bin拍了起来,并且没有反映原始图像的直方图。我很确定,当您降低对比度时,bin高度相对相同,但是整个直方图会变窄。但是在这种情况下,尽管它变窄了,但最后一个垃圾箱看起来比预期的要高得多。我已附上我的代码和其他相关图像。
im = imread('elephant.jpg');
%converts image to grayscale and displays it
im_gray = rgb2gray(im);
figure;
imshow(im_gray)
title ('Original Gray-scale Image');
%displays the histogram of the grayscale image
figure;
imhist(im_gray);
axis([0 255 0 22920])
title ('Histogram of the Original Gray-scale Image')
xlabel ('Pixel Value (Gray-level), ai')
ylabel ('Number of Pixels, Ni')
%lowers the contrast of original image --> deteriorated image
J = imadjust(im_gray,[0 0.5], [0.3 0.5]);
figure;
imshow(J);
title ('Deteriorated Image')
%displays histogram of the deteriorated image
figure;
imhist(J);
axis([0 255 0 489000])
title ('Histogram of the Deteriorated Image')
xlabel ('Pixel Value (Gray-level), ai')
ylabel ('Number of Pixels, Ni')
最后一个bin“增加”,因为imadjust
限制了像素范围。