comparison transformations/DistorsionGauss.py @ 105:901ab3329064

Parametre deterministe retourne dans les fonctions '_determined_by_complexity' et le parametre stochastique retourne dans les fonctions conventionnelles
author SylvainPL <sylvain.pannetier.lebeuf@umontreal.ca>
date Fri, 12 Feb 2010 10:30:02 -0500
parents e352a98fcc0a
children 1b315470a566
comparison
equal deleted inserted replaced
104:fe6f96951ed1 105:901ab3329064
19 def __init__(self): 19 def __init__(self):
20 self.ecart_type=0.1 #L'ecart type de la gaussienne 20 self.ecart_type=0.1 #L'ecart type de la gaussienne
21 self.effectuer=1 #1=on effectue et 0=rien faire 21 self.effectuer=1 #1=on effectue et 0=rien faire
22 22
23 def get_settings_names(self): 23 def get_settings_names(self):
24 return ['ecart_type','effectuer'] 24 return ['effectuer']
25 25
26 ## def get_settings_name_determined_by_complexity(self): 26 def get_settings_names_determined_by_complexity(self,complexity):
27 ## return ['ecart_type'] 27 return ['ecart_type']
28 28
29 def regenerate_parameters(self, complexity): 29 def regenerate_parameters(self, complexity):
30 self.ecart_type=float(complexity)/10 30 self.ecart_type=float(complexity)/10
31 self.effectuer =numpy.random.binomial(1,0.3) ##### On a 30% de faire un bruit ##### 31 self.effectuer =numpy.random.binomial(1,0.3) ##### On a 30% de faire un bruit #####
32 return self._get_current_parameters() 32 return self._get_current_parameters()
33 33
34 def _get_current_parameters(self): 34 def _get_current_parameters(self):
35 return [self.ecart_type,self.effectuer] 35 return [self.effectuer]
36 36
37 ## def get_parameters_determined_by_complexity(self, complexity): 37 def get_parameters_determined_by_complexity(self,complexity):
38 ## return [float(complexity)/10] 38 return [float(complexity)/10]
39 39
40 def transform_image(self, image): 40 def transform_image(self, image):
41 if self.effectuer == 0: 41 if self.effectuer == 0:
42 return image 42 return image
43 43