location of pixel from minimum and maximum value is in histogram
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
can you help me, please? I want to know where the location of pixel from minimum and maximum value is in histogram ?
0 commentaires
Réponses (2)
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);
0 commentaires
Yudawan Hidayat
le 13 Avr 2020
5 commentaires
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.
Voir également
Catégories
En savoir plus sur MATLAB Support Package for USB Webcams dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!