Mercurial > ift6266
comparison transformations/PoivreSel.py @ 100:67e655fc1d0b
Separation des parametres deterministes et stochastiques dans les methodes retournant noms et valeurs
author | SylvainPL <sylvain.pannetier.lebeuf@umontreal.ca> |
---|---|
date | Fri, 12 Feb 2010 09:53:40 -0500 |
parents | ab57cd2b252c |
children | 553acf4beffb |
comparison
equal
deleted
inserted
replaced
99:939915371a6d | 100:67e655fc1d0b |
---|---|
26 self.proportion_bruit=0.1 #Le pourcentage des pixels qui seront bruites | 26 self.proportion_bruit=0.1 #Le pourcentage des pixels qui seront bruites |
27 self.nb_chng=10 #Le nombre de pixels changes. Seulement pour fin de calcul | 27 self.nb_chng=10 #Le nombre de pixels changes. Seulement pour fin de calcul |
28 self.effectuer=1 #Vaut 1 si on effectue et 0 sinon. | 28 self.effectuer=1 #Vaut 1 si on effectue et 0 sinon. |
29 | 29 |
30 def get_settings_names(self): | 30 def get_settings_names(self): |
31 return ['proportion_bruit','effectuer'] | 31 return ['effectuer'] |
32 | 32 |
33 ## def get_settings_name_determined_by_complexity(self): | 33 def get_settings_name_determined_by_complexity(self): |
34 ## return ['proportion_bruit'] | 34 return ['proportion_bruit'] |
35 | 35 |
36 def regenerate_parameters(self, complexity): | 36 def regenerate_parameters(self, complexity): |
37 self.proportion_bruit = float(complexity)/5 | 37 self.proportion_bruit = float(complexity)/5 |
38 self.nb_chng=int(1024*self.proportion_bruit) | 38 self.nb_chng=int(1024*self.proportion_bruit) |
39 self.changements=random.sample(xrange(1024),self.nb_chng) #Les pixels qui seront changes | 39 self.changements=random.sample(xrange(1024),self.nb_chng) #Les pixels qui seront changes |
40 self.effectuer =numpy.random.binomial(1,0.25) ##### On a 25% de faire un bruit ##### | 40 self.effectuer =numpy.random.binomial(1,0.25) ##### On a 25% de faire un bruit ##### |
41 return self._get_current_parameters() | 41 return self._get_current_parameters() |
42 | 42 |
43 def _get_current_parameters(self): | 43 def _get_current_parameters(self): |
44 return [self.proportion_bruit,self.effectuer] | 44 return [self.effectuer] |
45 | 45 |
46 ## def get_parameters_determined_by_complexity(self, complexity): | 46 def get_parameters_determined_by_complexity(self, complexity): |
47 ## return [self.proportion_bruit] | 47 return [self.proportion_bruit] |
48 | 48 |
49 def transform_image(self, image): | 49 def transform_image(self, image): |
50 if self.effectuer == 0: | 50 if self.effectuer == 0: |
51 return image | 51 return image |
52 | 52 |