Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

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

1 Ansicht (letzte 30 Tage)
mohammed alany
mohammed alany am 5 Apr. 2019
Geschlossen: MATLAB Answer Bot am 20 Aug. 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

Antworten (0)

Diese Frage ist geschlossen.

Tags

Noch keine Tags eingegeben.

Community Treasure Hunt

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

Start Hunting!

Translated by