Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

I cannot remove objects that do not fit the metric from the tagged image, how can I remove them?

1 visualización (últimos 30 días)
%%
[B,L] = bwboundaries(BM,'noholes'); %BM is image(2717x1985 double)
imshow(label2rgb(L,@jet,[.5 .5 .5]))
hold on
%%
for k = 1:length(B)
boundary = B{k};
plot(boundary(:,2),boundary(:,1),'w','LineWidth',2)
end
%%
stats = regionprops(L,'Centroid','Eccentricity','MajorAxisLength','MinorAxisLength','Area');
t=0.85;
for k=1:length(B)
boundary = B{k};
Eccentricity=stats(k).Eccentricity;
metric=Eccentricity;
metric_string = sprintf('%2.3f',metric);
if metric <= t;
centroid = stats(k).Centroid;
plot(centroid(1),centroid(2),'k*');
%metriği sağlamayan objelerin silinmesi
else;
L(L==k) = 0;
end;
end;

Respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by