Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Explain this code, what happen for field_11 ?? i can not understand this code

1 vue (au cours des 30 derniers jours)
mohammed alany
mohammed alany le 5 Avr 2019
Clôturé : MATLAB Answer Bot le 20 Août 2021
% im2 = binary image;
field_l1 = bwmorph(im2,'thin',inf);
while(1)
E_pts=[];
for i=2:size(field_l1,1)-1
for j=2:size(field_l1,2)-1
if(field_l1(i,j)==1)
A=double(field_l1(i-1:i+1,j-1:j+1));
if(sum(A(:))==2)
E_pts=[E_pts;i j];
end
end
end
end
if(isempty(E_pts))
break
end
for i=1:size(E_pts,1)
curr_pt=E_pts(i,:);
field_l1(curr_pt(1),curr_pt(2))=0;
flag=0;
while(1)
pts=[];
for j=-1:1
for k=-1:1
if(field_l1(curr_pt(1)+j,curr_pt(2)+k)==1)
pts=[pts;curr_pt(1)+j curr_pt(2)+k];
end
end
end
if(isempty(pts))
break
end
if(size(pts,1)>1)
break;
else
curr_pt=pts(1,:);
field_l1(curr_pt(1),curr_pt(2))=0;
end
% figure(3)
% imshow(field_l1)
% drawnow
% pause(0.1)
end
end
se=strel('disk',1);
field_l1=imdilate(field_l1,se);
field_l1 = bwmorph(field_l1,'thin',inf);
end

Réponses (0)

Tags

Aucun tag saisi pour le moment.

Community Treasure Hunt

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

Start Hunting!

Translated by