Suppose that X is the set of Euclidean coordinates corresponding to the input binary image, and that K is the set of coordinates for the structuring element. Let Kx denote the translation of K so that its origin is at x. Then the dilation of X by K is simply the set of all points x such that the intersection of Kx with X is non-empty.

Figure 1 A 3×3 square structuring element

Figure 2 Effect of dilation using a 3×3 square structuring element

Figure 3 Graylevel dilation using a disk shaped structuring element. The graphs show a vertical cross-section through a graylevel image.

Figure 4 Cross-shaped structuring element

Suppose that X is the set of Euclidean coordinates corresponding to the input binary image, and that K is the set of coordinates for the structuring element. Let Kx denote the translation of K so that its origin is at x. Then the erosion of X by K is simply the set of all points x such that Kx is a subset of X.

Figure 2 Effect of erosion using a 3×3 square structuring element

Figure 3 Graylevel erosion using a disk shaped structuring element. The graphs show a vertical cross-section through a graylevel image.