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.
1 import numpy as np 2 import ia870 as MT 3 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) 8 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')