SMIL  0.9.1
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.imageIn[i + nb]
8  self.imageOut[i] = int(pixSum / len(relOffList))
9 
10 
11 imIn = Image("http://smil.cmm.mines-paristech.fr/images/lena.png")
12 imOut = Image(imIn)
13 
14 func = myMeanMorphoFunction()
15 func(imIn, imOut)
16 
17 imOut.show()
18