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

Figure 6.2 - Morphological gradients

Description

Figure 6.2 shows the morphological gradient of a gray-scale image.

As is the case with differential gradients, the morphological gradient can be used in conjunction with thresholding to perform gray-scale edge detection. The histogram of the gradient image is used to determine a threshold value and the thresholded gradient is the edge image.

Demo Script

 1 import ia870 as MT
 2 
 3 f = adreadgray('astablet.tif')
 4 f = rot90(f[:,:shape(f)[1]/2+10])
 5 
 6 B1 = MT.iasedisk(1)
 7 B0 = MT.iasebox(0)
 8 
 9 i1 = MT.iagradm(f,B1,B0)
10 i2 = MT.iagradm(f,B0,B1)
11 i3 = MT.iagradm(f,B1,B1)
12 
13 adshow(f,' (a) Original image')
14 adshow(MT.ianeg(i1),'(b) Internal gradient')
15 adshow(MT.ianeg(i2),'(c) External gradient')
16 adshow(MT.ianeg(i3),'(d) Morphological gradient')

(a) Original image

(b) Internal gradient

(c) External gradient

(d) Morphological gradient