- you might match multiple local minima
- you are going to plot all the local minima adjacent to each other, not their original distance apart
- you are going to have trouble if the pattern is \__/ instead of \_/ i.e., if the local min is more than one point wide
- you might want to think about using diff()
- local min could occur at the endpoints -- with your current code, a continually-decreasing or -increasing set of data would not register any local min.
is this the right way to find local minima of histogram
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Muhammad Ali Qadar
el 8 de Nov. de 2013
Comentada: Image Analyst
el 26 de Ag. de 2016
hi, I am trying to find the local minima value of image's histogram, I am filtering image from 1*3 filter and then finding minima, waiting for your suggestions
I = imread('eight.tif');I=I(:)';I=double(I);
x=[1 1 1]/3;
f=filter2(x,I,'same');
y = sin(5*f);
idx = [false, y(3:end)>y(2:end-1) & y(2:end-1)<y(1:end-2), false];
xmin = f(idx)
plot(xmin,'o-')
thanks in Advance.
0 comentarios
Respuesta aceptada
Walter Roberson
el 8 de Nov. de 2013
Not so bad, but remember
7 comentarios
Image Analyst
el 26 de Ag. de 2016
"count <= 0 will give you the logical array" and that is what he calls L.
Más respuestas (1)
Image Analyst
el 8 de Nov. de 2013
Way too complicated for me. Actually I didn't even see you take the histogram, which you do with imhist(). I'm not sure what you're doing with the sine wave. Why not just use imhist() and imregionalmin()? It's much more straightforward and only 2 lines of code.
[counts, grayLevels] = imhist(I); % Get histogram into "counts"
minIndexes = imregionalmin(counts); % Find indexes of local mins in the histogram.
To get the gray levels instead of the indexes, you need to subtract 1 because index 1 is actually gray level 0.
grayLevelsAtLocalMins = minIndexes - 1;
Ver también
Categorías
Más información sobre Histograms en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!