Toolbox ia870 | List of Figures | Fig. 6.15 | Fig. 6.17

Figure 6.16 - Connected filter versus nonconnected filter

Description

A connected filter is an increasing operator that only merges flat zones. The flat zones of the filtered image contain the flat zones of the input image. An advantage of a connected filter is that if an edge exists in the output image, then the edge also exists in the input image. A connected filter never introduces a false edge. An illustration of this is shown in Fig. 6.16 with a binary image and a gray-scale image. Note how the outputs of nonconnected filters introduce artifacts with the structuring element shape.

Demo Script

 1 import ia870 as MT
 2 
 3 Img1 = adreadgray('MVBook/tools.png')
 4 Box = MT.iasebox(5)
 5 Img2 = MT.iaopen(Img1,Box)
 6 Img3 = MT.iaopenrec(Img1,Box)
 7 
 8 adshow(MT.iapad(MT.ianeg(Img1)), '(a) Binary image')
 9 adshow(MT.iapad(MT.ianeg(Img2)), '(b) Regular opening by a square (nonconnected)')
10 adshow(MT.iapad(MT.ianeg(Img3)), '(c) Reconstructive opening (connected)')
11 
12 Img4 = adreadgray('astablet.tif')
13 Img4 = Img4[:,:shape(Img4)[1]/2 +10]
14 Img5 = MT.iaopen(Img4,Box)
15 Img6 = MT.iaopenrec(Img4,Box)
16 
17 adshow(Img4,'(d) Greyscale image')
18 adshow(Img5, '(e) Regular opening by a square(nonconnected)')
19 adshow(Img6, '(f) Reconstructive opening (connected)')

(a) Binary image

(b) Regular opening by a square (nonconnected)

(c) Reconstructive opening (connected)

(d) Greyscale image

(e) Regular opening by a square(nonconnected)

(f) Reconstructive opening (connected)