Source: https://brunl01.users.greyc.fr/ENSEIGNEMENT/COURS/05_erosion_dilatation.pdf