location of pixel from minimum and maximum value is in histogram

7 vues (au cours des 30 derniers jours)
Yudawan Hidayat
Yudawan Hidayat le 9 Avr 2020
Commenté : Image Analyst le 16 Avr 2020
can you help me, please? I want to know where the location of pixel from minimum and maximum value is in histogram ?

Réponses (2)

Image Analyst
Image Analyst le 9 Avr 2020
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);

Yudawan Hidayat
Yudawan Hidayat le 13 Avr 2020
this is can't work in rgb image bro :(
  5 commentaires
Yudawan Hidayat
Yudawan Hidayat le 16 Avr 2020
I want to find the matrix value of the min and max histogram
Image Analyst
Image Analyst le 16 Avr 2020
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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur MATLAB Support Package for USB Webcams dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by