Maximal Max-tree Simplification Methodology

MainPage || iamxt

 1 import iamxt
 2 import numpy as np
 3 import ia636
 4 
 5 # Parameters of the method
 6 option = "MSER" #Options "MSER" "T"
 7 n = 8
 8 attr = "area"
 9 
10 #Reading and displaying image
11 img = adreadgray('/awmedia/www/media/Attachments/iamxt-tutorial/interactive_maxtree01/MRI_sagittal.png')[:,::-1].copy()
12 
13 Bc = np.ones((3,3),dtype = bool)
14 # Building the max-tree
15 mxt = iamxt.MaxTreeAlpha(img,Bc)
16 adshow(img, "Original Image (%d nodes)" % mxt.node_array.shape[1])
17 
18 
19 ext = mxt.computeExtinctionValues(mxt.node_array[3,:],attr)
20 
21 
22 # Result of the extinction filter
23 mxt.extinctionFilter(ext,n)
24 img_ef = mxt.getImage()
25 adshow(img_ef, 'Image after the Extinction %s Filter (%d nodes)' % (attr,mxt.node_array.shape[1]))
26 
27 
28 sm = mxt.computeStabilityMeasure()
29 mxt.mmsMSER(sm)
30 img_mms= mxt.getImage()
31 adshow(img_mms, 'Image after the EF + MMS-%s, (%d nodes)' % (option,mxt.node_array.shape[1]))
32 
33 
34 area = mxt.node_array[3,:]
35 mmgraphviz(mxt.generateCCGraph(parent_scale = True),"Resulting max-tree")

Original Image (5458 nodes)

Image after the Extinction area Filter (560 nodes)

Image after the EF + MMS-MSER, (16 nodes)

/media/_xsb/iamxt-tutorial/iamxt04_mms_methodology/GRVIZ11923_001.png

Resulting max-tree

Do it yourself

Apply the maximal max-tree simplification methodology to the license plate image in a way that all plate characters are preserved.

 1 img =adreadgray('/awmedia/www/media/Attachments/homeroberto/homeroberto_softwareX_bbox/lp.png')
 2 img = adreadgray('/awmedia/www/media/Attachments/iamxt-tutorial/iamxt01_mms_methodology/lp.png')
 3 adshow(img,'License plate image')
 4 
 5 option = "MSER" # "MSER" "T"
 6 n = 15
 7 attr = "height"
 8 Bc = np.ones((3,3), dtype = bool)
 9 mxt = iamxt.MaxTreeAlpha(255 - img,Bc)
10 adshow(img, "Original Image (%d nodes)" % mxt.node_array.shape[1])
11 h = mxt.computeHeight()
12 ext = mxt.computeExtinctionValues(h,attr)
13 
14 mxt.extinctionFilter(ext,n)
15 img_ef =  mxt.getImage()
16 adshow(img_ef, 'Image after the Extinction %s Filter (%d nodes)' % (attr,mxt.node_array.shape[1]))
17 sm = mxt.computeStabilityMeasure()
18 mxt.mmsMSER(sm)
19 img_mms=  mxt.getImage()
20 adshow(img_mms, 'Image after the EF + MMS-%s, (%d nodes)' % (option,mxt.node_array.shape[1]))
21 mmgraphviz(mxt.generateCCGraph(parent_scale = False),"Teste")

License plate image

Original Image (1202 nodes)

Image after the Extinction height Filter (1202 nodes)

Image after the EF + MMS-MSER, (28 nodes)

/media/_xsb/iamxt-tutorial/iamxt04_mms_methodology/GRVIZ11923_002.png

Teste