Toolbox ia870 | List of Figures | Fig. 3.15 | Fig. 3.17

Figure 3.16 - Filling holes

Description

To differentiate the reconstructions resulting from conditional dilation and conditional erosion, we refer to Eq. (3.7) as inf-geodesic reconstruction and define sup-geodesic reconstruction of from the marker using the connectivity given by the structuring element by

Once the sup-reconstruction is defined, we can illustrate hole filling with the help of Fig. 3.16. The input is a contour image, shown in part (a). Now we will work on the dual, so the background pixels constitute the image of interest. The background pixels inside the contour are the only pixels not connected to the image frame. The sup-reconstruction from the dual marker placed at the image frame [part (b)] will detect as background only the background regions touching the frame. The result of the sup-reconstruction is shown in part (c), which is the input image with its holes detected.

Demo Script

 1 import numpy as np
 2 import ia870 as MT
 3 
 4 A = adreadgray('blob3.tif')
 5 A = MT.iaedgeoff(A)
 6 A = MT.iagradm(A)
 7 F = MT.ianeg(MT.iaframe(A))
 8 
 9 S = MT.iasuprec(F,A,MT.iasebox())
10 Fs =MT.iaero(F)
11 
12 adshow(MT.iapad(MT.ianeg(A)), '(a)')
13 adshow(MT.iapad(MT.ianeg(F)), '(b)')
14 adshow(MT.iapad(MT.ianeg(S)), '(c)')

(a)

(b)

(c)