How do I find the maximum and minimum of a histogram in MATLAB?

20 vues (au cours des 30 derniers jours)
roya a
roya a le 29 Juil 2013
I want to find max and min of a histogram in matlab please advise me. thanks
  4 commentaires
dpb
dpb le 29 Juil 2013
Again, too nebulous. What do you mean "maximum value of the intensity axes"?
You mean the maximum bin count? If so, if you used either hist or histc then it's just max|min on the returned counts vector.
If something else, explain what.
roya a
roya a le 29 Juil 2013
for example: i have one image with these intensity: 13 , 23 , 23 , 13 , 6 , 1 , 3 , 1 , 1 , 1 , 2, 5 , 5, 13, 5, 1, 3, 4 , 3, 1, 1, 2, 6, 3, 1, 0, 0, 2, 3, 23, 3, 1 , 3. max=1 , min=4

Connectez-vous pour commenter.

Réponses (4)

Image Analyst
Image Analyst le 29 Juil 2013
[pixelCounts, grayLevels] = imhist(grayImage);
minGrayLevel = min(grayImage(:));
maxGrayLevel = max(grayImage(:));
% or
minGrayLevel = find(pixelCounts > 0, 1, 'first');
maxGrayLevel = find(pixelCounts > 0, 1, 'last');
minCounts = min(pixelCounts(:));
maxCounts = max(pixelCounts(:));
  1 commentaire
roya a
roya a le 29 Juil 2013
let me give you one example: we have axis X and axis Y. any maximum point in a plot has individual X and Y value. So,Im looking for X and Y values of maximum point in a histogram. by these commands i can get only Y value of maximum point how about X value?

Connectez-vous pour commenter.


Oliver Herbage
Oliver Herbage le 25 Oct 2016
Using the function 'histogram.m' H = histogram(X) will plot a histogram and return details to 'H'
'H.Values' returns a vector of the values from these details and the max and min functions can then be used on this to obtain the max and min of the histogram (e.g. 'max(H.Values)' and 'min(H.Values)')

Sean de Wolski
Sean de Wolski le 29 Juil 2013
doc min
doc max
doc histc

dpb
dpb le 29 Juil 2013
Modifié(e) : dpb le 29 Juil 2013
doc min % and/or max
Look at alternate (optional) returns.

Catégories

En savoir plus sur Data Distribution Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by