SMIL  0.8
 All Classes Functions Variables Groups Pages
custom_morpho_operator.py

1 from smilPython import *
2 
3 class myMeanMorphoFunction(MorphImageFunctionBase_UINT8):
4  def processPixel(self, i, relOffList):
5  pixSum = 0.
6  for nb in relOffList:
7  pixSum += self.imIn[i + nb]
8  self.imOut[i] = int(pixSum / len(relOffList))
9 
10 
11 imIn = Image("http://cmm.ensmp.fr/~faessel/smil/images/lena.png")
12 imOut = Image(imIn)
13 
14 func = myMeanMorphoFunction()
15 func(imIn, imOut)
16 
17 imOut.show()
18