Toolbox ia870 | List of Figures | Fig. 6.4 | Fig. 6.6

Figure 6.5 - Open top-hat to compensate uneven illumination

Description

Open top-hat is very useful as a preprocessing step to correct uneven illumination before applying a threshold, thereby acting as an adaptive thresholding technique. Figure 6.5 illustrates this feature: (a) input image; (b) opened image; (c) top-hat image; and (d) thresholded top-hat image.

Demo Script

 1 import ia870 as MT
 2 
 3 f = adreadgray('MVBook/rgrid_n.png')
 4 D = MT.iasedisk(10)
 5 g = MT.iaopen(f, D)
 6 gth = MT.iaopenth(f, D)
 7 go = MT.iathreshad(gth, 20)
 8 
 9 adshow(f,'(a) Input image')
10 adshow(g,'(b) Opened Iimage')
11 adshow(gth,'(c) Top-hat image')
12 adshow(go,'(d) Thresholded top-hat image')

(a) Input image

(b) Opened Iimage

(c) Top-hat image

(d) Thresholded top-hat image