Borrar filtros
Borrar filtros

How can i fix the threshold automatically from the histogram?

2 visualizaciones (últimos 30 días)
How can i fix the threshold automatically from the histogram?

Respuesta aceptada

Walter Roberson
Walter Roberson el 16 de Dic. de 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 comentarios
Walter Roberson
Walter Roberson el 16 de Dic. de 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 el 16 de Dic. de 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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Histograms en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by