function img_erode = my_erode(img,se)

[x,y] = size(img);
img_erode = zeros(x,y);
[sx,sy] = size(se);

lx = floor(sx/2);
ly = floor(sy/2);

for i=(lx+1):(x-lx)
    for j=(ly+1):(y-ly)
        roi = img(i-lx:i+lx, j-ly:j+ly);
        bool_roi = and(roi,se);
        if isequal(se,bool_roi)
            img_erode(i,j) = 1;
        end
    end

end