%f: original image
%radius: size of the structuring element
%iter: number of reconstruction iteration
function f_reconstruct = closing_reconstruction(f,radius,iter)
    %erosion
    se = strel('disk',radius);
    f_dilate = imdilate(f,se);
    figure;
    imshow(f_dilate);

    %reconstruction
    se = strel('disk',1);
    f_reconstruct = f_dilate;
    for i = 1:iter
        f_close = imerode(f_reconstruct,se);
        f_reconstruct = (f_close>f).*f_close + (f_close<=f).*f;
    end
    figure;
    imshow(f_reconstruct);