【发布时间】:2020-01-19 22:21:55
【问题描述】:
我使用了 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')
【问题讨论】:
-
如果有帮助,请考虑接受答案。
标签: matlab height histogram bin imaging