Azzera filtri
Azzera filtri

How can i fix the threshold automatically from the histogram?

2 visualizzazioni (ultimi 30 giorni)
How can i fix the threshold automatically from the histogram?

Risposta accettata

Walter Roberson
Walter Roberson il 16 Dic 2015
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 Commenti
Walter Roberson
Walter Roberson il 16 Dic 2015
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.
But more likely what you are trying to work on is histogram equalization
Image Analyst
Image Analyst il 16 Dic 2015
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.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by