How do I find the maximum and minimum of a histogram in MATLAB?
Mostrar comentarios más antiguos
I want to find max and min of a histogram in matlab please advise me. thanks
4 comentarios
What does this mean?
If you have the data that created the histogram then it's simply min()/max() of that data. If you don't, then all you have is the bin boundaries and all you can say is that the values are within them.
This, of course, means that there were no values outside the range of the last bin edge that were ignored (as histc does if don't use inf for range). And, if there weren't such samples ignored, there's no way of knowing if those extreme value(s) were/were not included in the first/last bins.
Once a histogram has been formed there's a loss of information that is simply irretrievable w/o the raw data.
roya a
el 29 de Jul. de 2013
dpb
el 29 de Jul. de 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
el 29 de Jul. de 2013
Respuestas (4)
Image Analyst
el 29 de Jul. de 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 comentario
roya a
el 29 de Jul. de 2013
Oliver Herbage
el 25 de Oct. de 2016
2 votos
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
el 29 de Jul. de 2013
doc min
doc max
doc histc
doc min % and/or max
Look at alternate (optional) returns.
Categorías
Más información sobre Histograms en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!