The morphological close operation is a dilation followed by an erosion, using the same structuring element for both operations. Using a logical matrix a as input with a square structure element,
a = [0 0 1 0 0; 1 1 1 1 1; 0 1 0 1 0; 1 0 0 0 1; 0 0 0 0 0];se = strel('square', 3);
The result I obtained after performing a dilation, imdilate() followed by an erosion, imerode() on a:
a = imdilate(a, se);a = imerode(a, se);% output
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 0 0 0 1
The result I obtained when applying imclose() directly on a:
a = imclose(a, se);% output 0 0 1 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 0 0 0 0 0
Did I miss out something? Why the outputs are different?
Best Answer