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/iamxt09_mms_methodology/GRVIZ11945_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 adshow(img,'License plate image')
 3 img_neg = img.max() - img
 4 
 5 # Parameters of the method
 6 option = "MSER" #Options "MSER" "T"
 7 n = 15
 8 attr = "height"
 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_neg,Bc)
16 adshow(img_neg, "Original Image (%d nodes)" % mxt.node_array.shape[1])
17 
18 
19 ext = mxt.computeExtinctionValues(mxt.computeHeight(),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")

License plate image

Original Image (23978 nodes)

Image after the Extinction height Filter (697 nodes)

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

/media/_xsb/iamxt-tutorial/iamxt09_mms_methodology/GRVIZ11945_002.png

Resulting max-tree