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

Figure 2.5 - Application of closing and closing top-hat


Figure 2.5 shows an application of the closing and the closing top-hat. The closing of a shape by a large disk approximates its convex hull and the closing top-hat approximates its convex hull deficiencies. These deficiencies are commonly used in character recognition because of their powerful discriminant property.

Demo Script

 1 import numpy as np
 2 import ia870 as MT
 4 B = MT.iasedisk(10)
 5 F = MT.iapad(adreadgray('numbers.tif'),B)
 6 E = MT.iaclose(F,B)
 7 O = MT.iacloseth(F,B)
 9 adshow(MT.ianeg(F), '(a) Input image')
10 adshow(MT.ianeg(E), '(b) closing by a disk')
11 adshow(MT.ianeg(O), '(c) closing top-hat')

(a) Input image

(b) closing by a disk

(c) closing top-hat