License Plate Location using Extinction Filters

MainPage

 1 from max_tree_alpha import MaxTreeAlpha
 2 import numpy as np
 3 import ia636 as ia
 4 
 5 
 6 attribute = "volume"
 7 n = 15
 8 ID = 25
 9 
10 # Pré-processamento
11 img = adreadgray('Attachments/iamxt/MainPage/lp_image.png')
12 adshow(img,'Original image: %d'%ID)
13 img_neg = img.max() - img
14 
15 Bc = np.ones((3,3), dtype = bool)
16 mxt = MaxTreeAlpha(img_neg,Bc)
17 nleaves = (mxt.node_array[1,:] == 0).sum()
18 
19 print 'Original Max-Tree'
20 print 'Nb. of Nodes:', mxt.node_array.shape[1]
21 print 'Nb. of leaves:', nleaves
22 print
23 
24 V = mxt.computeVolume()
25 ext = mxt.computeExtinctionValues(V,attribute)
26 mxt.extinctionFilter(ext,n)
27 
28 nleaves = (mxt.node_array[1,:] == 0).sum()
29 
30 print 'Max-Tree after the Extinction Filter: ' + attribute + ' attribute'
31 print 'Nb. of nodes:', mxt.node_array.shape[1]
32 print 'Nb. of leaves:', nleaves
33 print
34 
35 uimg = mxt.getImage()
36 
37 
38 adshow((uimg.max() - uimg), 'Image after the Extinction filter applied to its minima')
Original Max-Tree
Nb. of Nodes: 24310
Nb. of leaves: 6031

Max-Tree after the Extinction Filter: volume attribute
Nb. of nodes: 1202
Nb. of leaves: 15

Original image: 25

Image after the Extinction filter applied to its minima

1 uimg = uimg/4
2 mxt2 = MaxTreeAlpha(uimg,Bc)
3 graph = mxt2.generateCCGraph(parent_scale = True)
4 mmgraphviz(graph,title='Max-Tree after the Extinction Filter (some nodes were omitted) '+ attribute + ' attribute')
/media/_xsb/iamxt/lpl_ef/GRVIZ76182_001.png

Max-Tree after the Extinction Filter (some nodes were omitted) volume attribute