Figure 3.17 - Component detection
The reconstructive opening requires two structuring elements: one to specify the shape of the fitting criterion (), and the other to specify the connectivity (). Unless otherwise specified, it is assumed that is the 8-connected mask about the origin. This results in reconstructive openings that pass all 8-connected components that are not eliminated by the original opening by . Observe that the reconstructive opening can be obtained by letting the marker be the erosion of the input image instead of the opening:
Figure 3.17 shows an example of the reconstructive opening being used to detect symbols in which a straight vertical line of length 15 can be fit: (a) input text image, (b) the opening by the vertical line, and (c) the reconstructive opening. The three symbols possessing the required geometry are detected.
1 import ia870 as MT 2 3 A = adreadgray('img_hofig3s17_001.jpg') 4 B = MT.iaseline(15,90) 5 C = MT.iaopen(A,B) 6 D = MT.iaopenrec(A,B,MT.iasebox()) 7 8 adshow(MT.iapad(MT.ianeg(A)),'(a) input image') 9 adshow(MT.iapad(MT.ianeg(C)),'(b) opening by vertical line of 15 pixels length') 10 adshow(MT.iapad(MT.ianeg(D)),'(c) reconstruction')