Mercurial > ift6266
changeset 125:5d3a7a4e30e9
little changes in Rature and occlusion to fit with visualisation
author | Xavier Glorot <glorotxa@iro.umontreal.ca> |
---|---|
date | Thu, 18 Feb 2010 12:58:34 -0500 |
parents | b852dddf43a6 |
children | 66b9513b578f a507adba0ce3 |
files | transformations/Occlusion.py transformations/Rature.py |
diffstat | 2 files changed, 11 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/transformations/Occlusion.py Thu Feb 18 12:33:17 2010 -0500 +++ b/transformations/Occlusion.py Thu Feb 18 12:58:34 2010 -0500 @@ -61,10 +61,10 @@ return ['haut','bas','gauche','droite','x_arrivee','y_arrivee','endroit','rajout','appliquer'] def regenerate_parameters(self, complexity): - self.haut=min(15,int(numpy.abs(numpy.random.normal(int(7*complexity),2)))) - self.bas=min(15,int(numpy.abs(numpy.random.normal(int(7*complexity),2)))) - self.gauche=min(15,int(numpy.abs(numpy.random.normal(int(7*complexity),2)))) - self.droite=min(15,int(numpy.abs(numpy.random.normal(int(7*complexity),2)))) + self.haut=min(15,int(numpy.abs(numpy.random.normal(int(8*complexity),2)))) + self.bas=min(15,int(numpy.abs(numpy.random.normal(int(8*complexity),2)))) + self.gauche=min(15,int(numpy.abs(numpy.random.normal(int(8*complexity),2)))) + self.droite=min(15,int(numpy.abs(numpy.random.normal(int(8*complexity),2)))) if self.haut+self.bas+self.gauche+self.droite==0: #Tres improbable self.haut=1 self.bas=1 @@ -76,7 +76,7 @@ self.y_arrivee=int(numpy.random.normal(0,3)) self.rajout=numpy.random.randint(0,self.longueur-1) #les bouts de quelle lettre - self.appliquer=numpy.random.binomial(1,0.3) ##### 30 % du temps, on met une occlusion ##### + self.appliquer=numpy.random.binomial(1,0.4) ##### 30 % du temps, on met une occlusion ##### if complexity == 0: #On ne fait rien dans ce cas self.applique=0
--- a/transformations/Rature.py Thu Feb 18 12:33:17 2010 -0500 +++ b/transformations/Rature.py Thu Feb 18 12:58:34 2010 -0500 @@ -54,7 +54,7 @@ def get_settings_names(self): return ['angle','numero','faire','crop_haut','crop_gauche','largeur_bande','smooth','nb_ratures'] - def regenerate_parameters(self, complexity): + def regenerate_parameters(self, complexity,next_rature = False): self.numero=random.randint(0,4999) #Ces bornes sont inclusives ! @@ -67,7 +67,9 @@ self.angle=int(numpy.random.normal(90,100*complexity)) - self.faire=numpy.random.binomial(1,0.15) ##### 15% d'effectuer une rature ##### + self.faire=numpy.random.binomial(1,0.2) ##### 15% d'effectuer une rature ##### + if next_rature: + self.faire = 1 #self.faire=1 #Pour tester seulement self.crop_haut=random.randint(0,17) @@ -80,7 +82,7 @@ self.smooth=4 else: self.smooth=3 - self.nb_ratures=int(numpy.random.normal(complexity*2,complexity*1.5))+1 + self.nb_ratures=1+int(numpy.random.rand()*3) #Creation de la "patch" de rature qui sera appliquee sur l'image if self.faire == 1: @@ -195,7 +197,7 @@ if self.fini == 0: #S'il faut rajouter des couches patch_temp=self.patch for w in xrange(1,self.nb_ratures): - self.regenerate_parameters(self.complexity) + self.regenerate_parameters(self.complexity,1) for i in xrange(0,32): for j in xrange(0,32): patch_temp[i,j]=max(patch_temp[i,j],self.patch[i,j])