Extinction Filter Example

MainPage

 1 import numpy as np
 2 import iamxt
 3 
 4 img = adreadgray(find_attachment_file('potatoes.png'))
 5 
 6 adshow(img, "Potatoes image")
 7 
 8 #Connectivity-8
 9 Bc = np.ones((3,3),dtype = bool)
10 
11 
12 # Building the max-tree
13 mxt = iamxt.MaxTreeAlpha(img,Bc)
14 n = 11
15 
16 for i in xrange(n,0,-1):
17     H = mxt.computeHeight() # Height attribute value computation
18     Hext = mxt.computeExtinctionValues(H,"height")
19     mxt.extinctionFilter(Hext,i)
20     filtered = mxt.getImage()
21     adshow(filtered,"Height extinction filter, n = %d" %i)

Potatoes image

Height extinction filter, n = 11

Height extinction filter, n = 10

Height extinction filter, n = 9

Height extinction filter, n = 8

Height extinction filter, n = 7

Height extinction filter, n = 6

Height extinction filter, n = 5

Height extinction filter, n = 4

Height extinction filter, n = 3

Height extinction filter, n = 2

Height extinction filter, n = 1