Toolbox ia870 | List of Figures | Fig. 1.5 | Fig. 1.7

Figure 1.6 - Erosion is not a subimage

Description

If the origin lies inside of the structuring element, then erosion has the effect of shrinking the input image, as illustrated by the robot example. Formally, we can state the following property: if the origin is contained within the structuring element, then the eroded image is a subset of the input image. Should the origin not lie within the structuring element, then it may not be that the eroded image lies within the input image. This situation is illustrated in Fig. 1.6.

Demo Script

 1 import numpy as np
 2 import ia870 as MT
 3 
 4 A = adreadgray('MVBook/club.png') > 0
 5 B = MT.iasetrans(MT.iasedisk(3),[14,-14])
 6 
 7 C = MT.iaero(A,B)
 8 
 9 
10 AC = MT.iasymdif(MT.iagradm(A),C)
11 
12 adshow(AC, '(a) original in outline, eroded in black')
13 adshow(MT.ianeg(MT.iaseshow(B,'EXPAND')), '(b) - structuring element that does not contain the origin.')

(a) original in outline, eroded in black

(b) - structuring element that does not contain the origin.