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

20 Ansichten (letzte 30 Tage)
roya a
roya a am 29 Jul. 2013
Beantwortet: Oliver Herbage am 25 Okt. 2016
I want to find max and min of a histogram in matlab please advise me. thanks
  4 Kommentare
dpb
dpb am 29 Jul. 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 am 29 Jul. 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

Melden Sie sich an, um zu kommentieren.

Antworten (4)

Image Analyst
Image Analyst am 29 Jul. 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 Kommentar
roya a
roya a am 29 Jul. 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?

Melden Sie sich an, um zu kommentieren.


Oliver Herbage
Oliver Herbage am 25 Okt. 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 am 29 Jul. 2013
doc min
doc max
doc histc

dpb
dpb am 29 Jul. 2013
Bearbeitet: dpb am 29 Jul. 2013
doc min % and/or max
Look at alternate (optional) returns.

Kategorien

Mehr zu Data Distribution Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by