Toolbox ia870 | List of Figures | Fig. 1.8 | Fig. 1.10

Figure 1.9 - Erosion for digital images

Description

The fitting characterization of Eq. (1.4) applies directly to digital space [as does the intersection formulation of Eq. (1.5)]. Consider the following example using the digital image and structuring element :

  The erosion is stored in image . The three digital images are graphically represented in Figure 1.9. The eroded image contains three points: (-1,-1) ,(0,-1) and (0,0) , which are the points that a translation of the structuring element by them yields a fit in the input image .

Demo Script

 1 import numpy as np
 2 import ia870 as MT
 3 import ia636 as ia
 4 
 5 S = MT.iabinary([
 6   [0, 0, 0, 0, 0, 0, 0],
 7   [0, 0, 1, 0, 1, 0, 0],
 8   [0, 0, 1, 1, 0, 1, 0],
 9   [0, 0, 1, 1, 1, 0, 0],
10   [0, 0, 0, 0, 0, 0, 0]])
11 
12 adshow(MT.ianeg(MT.iaseshow(S,'expand')), '(a) input image')
13 
14 E = MT.iabinary([
15   [0, 0, 0],
16   [0, 1, 0],
17   [0, 1, 1]])
18 adshow(MT.ianeg(MT.iaseshow(E,'expand')), '(b) structuring element')
19 
20 T = MT.iaero(S, MT.iaimg2se(E))
21 adshow(MT.ianeg(MT.iaseshow(T,'expand')), '(c) erosion between S and E')

(a) input image

(b) structuring element

(c) erosion between S and E