Toolbox ia870 | List of Figures | Fig. 2.2 | Fig. 2.4

Figure 2.3 - Closing

Description

The dual operation to opening is closing , which is defined as a dilation followed by an erosion. The closing of by is denoted by and defined by

Closing is denoted by in functional notation. In MT the close function is obtained by iaclose(A,B). Figure 2.3 illustrates closing. The effect can be seen in the manner in which the closing has filtered from the outside, smoothing only corners that protrude into the image.

Demo Script

 1 import numpy as np
 2 import ia870 as MT
 3 from handson.lib import draw_se_axis
 4 
 5 B = MT.iasedisk(10)
 6 adshow(MT.ianeg(draw_se_axis(MT.iaseshow(B))), '(a) Structuring element')
 7 
 8 y,x = np.indices((90,70))
 9 F = MT.iabinary((2*x) < (y))
10 
11 F = MT.iaunion(F, np.fliplr(F))
12 F = MT.iapad(F,MT.iasedisk(11))
13 adshow(MT.ianeg(F), '(b) input image')
14 
15 E = MT.iadil(F,B)
16 adshow(MT.ianeg(E), '(c) dilation')
17 
18 O = MT.iaclose(F,B)
19 adshow(MT.ianeg(O), '(d) closing')

(a) Structuring element

(b) input image

(c) dilation

(d) closing