Mercurial > ift6266
diff transformations/PoivreSel.py @ 76:42e3e2f67626
Mise a niveau specifications parametres deterministes et invariance des bites changees entre les appels de regenerate_parameters()
author | SylvainPL <sylvain.pannetier.lebeuf@umontreal.ca> |
---|---|
date | Wed, 10 Feb 2010 14:24:35 -0500 |
parents | 8b9fca879543 |
children | ab57cd2b252c |
line wrap: on
line diff
--- a/transformations/PoivreSel.py Wed Feb 10 14:12:34 2010 -0500 +++ b/transformations/PoivreSel.py Wed Feb 10 14:24:35 2010 -0500 @@ -25,11 +25,15 @@ self.nb_chng=10 #Le nombre de pixels changes. Seulement pour fin de calcul def get_settings_names(self): + return [] + + def get_settings_name_determined_by_complexity(self): return ['proportion_bruit'] def regenerate_parameters(self, complexity): self.proportion_bruit = float(complexity)/5 self.nb_chng=int(1024*self.proportion_bruit) + self.changements=random.sample(xrange(1024),self.nb_chng) #Les pixels qui seront changes return self._get_current_parameters() def _get_current_parameters(self): @@ -40,9 +44,8 @@ def transform_image(self, image): image=image.reshape(1024,1) - changements=random.sample(xrange(numpy.size(image)),self.nb_chng) #Les pixels qui seront changes for j in xrange(0,self.nb_chng): - image[changements[j]]=numpy.random.random() #On determine les nouvelles valeurs des pixels changes + image[self.changements[j]]=numpy.random.random() #On determine les nouvelles valeurs des pixels changes return image.reshape(32,32)