location of pixel from minimum and maximum value is in histogram
7 次查看(过去 30 天)
显示 更早的评论
can you help me, please? I want to know where the location of pixel from minimum and maximum value is in histogram ?
0 个评论
回答(2 个)
Image Analyst
2020-4-9
See if this is what you want:
% Read in image.
grayImage = imread('pout.tif');
subplot(2, 1, 1);
imshow(grayImage);
% Get histogram.
[counts, grayLevels] = imhist(grayImage);
subplot(2, 1, 2);
bar(grayLevels, counts, 1);
grid on;
title('Histogram of image', 'FontSize', 20);
% Get the min and max gray levels directly from the image.
minGLImage = min(grayImage(:))
maxGLImage = max(grayImage(:))
% Get the min and max gray levels from the histogram (instead of directly from the image).
minGL = grayLevels(find(counts, 1, 'first'))
maxGL = grayLevels(find(counts, 1, 'last'))
% Should be the same as from the image.
% Get the rows and columns where these occur in the image.
[minRows, minColumns] = find(grayImage == minGL);
[maxRows, maxColumns] = find(grayImage == maxGL);
% Plot these locations over the image in the graphical overlay.
subplot(2, 1, 1);
hold on; % Don't blow away image.
plot(minColumns, minRows, 'b.', 'MarkerSize', 25);
plot(maxColumns, maxRows, 'r.', 'MarkerSize', 25);
title('Red = max. Blue = min.', 'FontSize', 20);
0 个评论
Yudawan Hidayat
2020-4-13
5 个评论
Image Analyst
2020-4-16
I really don't know what this means. I've given you several guesses. Please define what a "max histogram" is because I don't know. All I know is that an image has one histogram, not several - no min histogram, no max histogram, no "any-kind-of-other" histogram, just one simple gray level histogram. And do you want the number of counts in the histogram bin? Or the values of pixels in the bins? Or the edges (min gray level and max gray level) that define one of the bins (like the one with the most counts in it)? Please give an example.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 MATLAB Support Package for USB Webcams 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!