changeset 30:a8ac3402eb45

Correction aux distortions élastiques (retourne float32) suite à tests avec testmod.py
author fsavard <francois.savard@polymtl.ca>
date Mon, 01 Feb 2010 08:54:10 -0500
parents b67d729ebfe3
children 7ef8aac2cdb5
files transformations/local_elastic_distortions.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/transformations/local_elastic_distortions.py	Fri Jan 29 17:16:04 2010 -0500
+++ b/transformations/local_elastic_distortions.py	Mon Feb 01 08:54:10 2010 -0500
@@ -29,7 +29,7 @@
     return [[0 for i in range(size[1])] for j in range(size[0])]
 
 class ElasticDistortionParams():
-    def __init__(self, image_size, alpha=0.0, sigma=0.0):
+    def __init__(self, image_size=(32,32), alpha=0.0, sigma=0.0):
         self.image_size = image_size
         self.alpha = alpha
         self.sigma = sigma
@@ -59,7 +59,7 @@
         return [self.alpha, self.sigma]
 
 class LocalElasticDistorter():
-    def __init__(self, image_size):
+    def __init__(self, image_size=(32,32)):
         self.image_size = image_size
 
         self.current_complexity = 0.0
@@ -298,7 +298,7 @@
         br_pixels = numpy.multiply(br_pixels, p.matrix_br_multiply)
 
         # sum to finish bilinear combination
-        return numpy.sum([tl_pixels,tr_pixels,bl_pixels,br_pixels], axis=0)
+        return numpy.sum([tl_pixels,tr_pixels,bl_pixels,br_pixels], axis=0).astype(numpy.float32)
 
 # TESTS ----------------------------------------------------------------------