Image opening is somewhat comparable to erosion. It is being applied to remove foreground pixels from the edges; however, it is less effective than erosion, in general.
Image opening is targeted at keeping foreground regions that have a similar shape to the structuring element or that can fully contain the structuring element while eliminating all other areas of foreground pixels.
To illustrate how it works in practice, we will use this image with geometrical figures and see how the opening is different than erosion:
Let's get to the coding part and apply the opening function to the preceding image:
using Images, ImageView, ImageMorphology ...