Toolbox ia870 | List of Figures | Fig. 2.13 | Fig. 2.16

Figure 2.14 - Radial opening

Description

A typical -opening filter is the radial opening. The radial opening is a -opening filter with a set of linear structuring elements of varying angles. Figure 2.14 shows an example of the application of a radial opening with four different directions, 0, 45, 90, and 135 deg: , , e

Demo Script

 1 import numpy as np
 2 import ia870 as MT
 3 from handson.lib import iabggmodel, draw_se_axis
 4 
 5 f = adreadgray('MVBook/blobs_1.png') > 0
 6 
 7 B1 = MT.iaseline(40,0)
 8 B2 = MT.iaserot(B1,45)
 9 B3 = MT.iaserot(B1,90)
10 B4 = MT.iaserot(B1,135)
11 
12 adshow(MT.ianeg(MT.iaseshow(B1)), 'B1')
13 adshow(MT.ianeg(MT.iaseshow(B2)), 'B2')
14 adshow(MT.ianeg(MT.iaseshow(B3)), 'B3')
15 adshow(MT.ianeg(MT.iaseshow(B4)), 'B4')
16 
17 p1 = MT.iaopen(f,B1)
18 p2 = MT.iaopen(f,B2)
19 p3 = MT.iaopen(f,B3)
20 p4 = MT.iaopen(f,B4)
21 p5 =  MT.iaunion(p1,p2,p3,p4)
22 
23 adshow(MT.iapad(MT.ianeg(f)), 'A')
24 adshow(MT.iapad(MT.ianeg(p1)), 'A opening B1')
25 adshow(MT.iapad(MT.ianeg(p2)), 'A opening B2')
26 adshow(MT.iapad(MT.ianeg(p3)), 'A opening B3')
27 adshow(MT.iapad(MT.ianeg(p4)), 'A opening B4')
28 adshow(MT.iapad(MT.ianeg(p5)), 'union')

B1

B2

B3

B4

A

A opening B1

A opening B2

A opening B3

A opening B4

union