How to include all objects using find for an image

5 visualizaciones (últimos 30 días)
Jason
Jason el 5 de En. de 2016
Comentada: Jason el 6 de En. de 2016
Hi. I am trying to identify the lowest 10 pixel values on an grayscale image. I already have a list of the lowest 10 values
Lout =
126
126
127
128
128
128
129
129
129
129
I then identify using the following
for ct=1:10
f1=Lout(ct);
[i,j] = find(ROI==f1,1,'first');
plot(j,i,'ro','LineWidth',2);
end
This breaks down when there are more than one pixel with a lowest value as in the list above and shown in the figure below by the red circles. (it only shows the lowest 4 instead of all 10)

Respuesta aceptada

Adam
Adam el 5 de En. de 2016
[~, idx] = sort( ROI(:) );
[i, j] = ind2sub( size( ROI ), idx(1:10) );
is how I would do it, though obviously where the 11th value is also equal to the 10th it will bias towards the first value found, but then any such method would have to choose between equal 10th and 11th values if you want exactly 10.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by