MATLAB Answers

how can i find more than one minimum points of the histogram??

조회 수: 6(최근 30일)
user06
user06 5 Feb 2015
댓글: Image Analyst 21 Feb 2015
Suppose I have a histogram and I want to find the minimum point of the histogram other than 0, then what procedure I should follow? In the histogram image below, the minimum point is approximately 10,15,17. Then how can I find this?

  댓글 수: 0

로그인 to comment.

답변(2개)

Image Analyst
Image Analyst 5 Feb 2015
Try this
% Get histogram
[pixelCounts, grayLevels] = imhist(grayImage);
% Find darkest bin with more than 15 pixels in it
darkestGL = find(pixelCounts > 15, 1, 'first');

  댓글 수: 36

표시 이전 댓글 수: 33
Image Analyst
Image Analyst 20 Feb 2015
I'm afraid I don't know how to help any differently. I gave you code that will answer the homework question but, for some reason that you can't explain, you don't like it. You say it doesn't give the 3 lowest/shortest bins, but it actually does . So good luck with it - finding your own algorithm.
user06
user06 20 Feb 2015
do one thing, attach the image and the histogram and the result...
user06
user06 20 Feb 2015
and the code u have given is just giving the first 3 minimum points. i want overall 3 minimum points

로그인 to comment.


Jos (10584)
Jos (10584) 17 Feb 2015
You can sort the outcome of the histogram
data = ceil(10*rand(100,1))
values = 1:10
count = histc(data,values)
[SortedCount, idx] = sort(count)
SortedValues = values(idx)
disp([SortedValues(:) SortedCount(:)])

  댓글 수: 6

표시 이전 댓글 수: 3
Jos (10584)
Jos (10584) 21 Feb 2015
Yes, because data is just an example containing values between 1 and 10. Then I sorted the count in ascending order, and sorted the values along with it. The first element of the sorted counts is belonging to the value that occurs least often (i.e., the minimum of the histogram!), the second element is the second minimum etc. If you run the code and look out the outputs you may see what happens.
user06
user06 21 Feb 2015
it is not sorting values as per the requirement. i want sorted values on x axis with respect to y. means the value on the x axis having the lowest value on the y axis, that should come first and so on.
Image Analyst
Image Analyst 21 Feb 2015
I did that in my code above. Like I said, "the lowest bin has one count in it and it occurs at bin 236. The second lowest bin also has only one pixel in it, and it occurs at gray level 237, and the third lowest bin also has only one count in it and it occurs at 247." Explain why 1 is not the lowest y value (count in the bin), and explain why 236,237,247 is not sorted.

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.


Translated by