Clear Filters
Clear Filters

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

1 view (last 30 days)
suppose there are two points a , b and i want a points which lies between these wo and having maximum value.

Accepted Answer

Image Analyst
Image Analyst on 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.

More Answers (0)

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!