Filter löschen
Filter löschen

how do i find maximum points between two given points of a histogram?

2 Ansichten (letzte 30 Tage)
suppose there are two points a , b and i want a points which lies between these wo and having maximum value.

Akzeptierte Antwort

Image Analyst
Image Analyst am 21 Feb. 2015
See this snippet:
img = uint8(randi(256, [800,600])-1); % Synthesize an image.
% Get the histogram.
[counts grayLevels] = imhist(img);
a = 4
b = 9
% Find the minimum count in the range [a,b]
minCountInRange = min(counts(a:b))
% Get a logical vector that says if the count is
% the min count value or not.
indexesWithCount = (counts == minCountInRange)
% Filter to get only those gray levels in the range [a,b]
% Now get the actual index number(s):
indexOfMin = find(indexesWithCount(a:b)) + a - 1
gls = grayLevels(indexOfMin)
% Note: gray level, say, 6 occurs at index 7 because
% a gray level of 0 starts at index 1, not index 0.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by