How can i fix the threshold automatically from the histogram?
조회 수: 1 (최근 30일)
이전 댓글 표시
How can i fix the threshold automatically from the histogram?
댓글 수: 0
채택된 답변
Walter Roberson
2015년 12월 16일
First you need to define how you want to make the selection.
In the general case, a histogram of values could have complexity equivalent to a list of random non-negative integers, with up to half of the values potentially being peaks. There could be multiple peaks of the same height; there could be multiple major modes.
댓글 수: 3
Walter Roberson
2015년 12월 16일
No, there is no function that combines all of those things.
You still have no defined how you want to make the selection; all you have done is restricted the number of bins without indicating how the threshold is to be chosen from the counts.
Image Analyst
2015년 12월 16일
I don't think histogram equalization would be what she wants. I think that would just make the three gray levels 0, 128, and 255 instead of whatever they are. I think she needs to define what needs to be done after the threshold, for example call regionprops(), like
bw1 = grayImage == grayLevel1;
measurements1 = regionprops(logical(bw1), 'All');
bw2 = grayImage == grayLevel2;
measurements2 = regionprops(logical(bw2), 'All');
bw3 = grayImage == grayLevel3;
measurements3 = regionprops(logical(bw3), 'All');
If it's really NOT 3 gray levels but three humps in the histogram, then she'll have to come up with a automatic thresholding scheme to pick them out. Perhaps multithresh() would do a good job there.
Such speculation can often be reduced if the poster would have just included the image in the first posting.
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!