1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| function Erosion_Callback(hObject, eventdata, handles)
% hObject handle to Erosion (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
img = handles.courant_data;
seuil = graythresh(img);
ImBin = im2bw(img,seuil);
[r c]=size(ImBin);
ImBinMod = ImBin;
%après voilà l'algorithme pour éroder l'image
for i=2 :1:r-1
for j=2 :1:c-1
if(ImBin(i-1,j) == 1 || ImBin(i,j-1) == 1 || ImBin(i+1,j) == 1 || ImBin(i,j+1) == 1 || ImBin(i,j) == 1)
ImBinMod(i,j) = 1;
else
ImBinMod(i,j) = 0;
end
end
end
axes(handles.axes2);
handles.imgt = ImBinMod;
subimage(handles.imgt);
%Grrr
handles.output = hObject; |
Partager