diff transformations/Rature.py @ 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 4a29910eae93
children a507adba0ce3
line wrap: on
line diff
--- 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])