Parcourir la source

Merge branch 'release/v0.2.8'

Jérôme BUISINE il y a 4 ans
Parent
commit
66d891ac5d
1 fichiers modifiés avec 9 ajouts et 6 suppressions
  1. 9 6
      classes/Transformation.py

+ 9 - 6
classes/Transformation.py

@@ -24,20 +24,23 @@ class Transformation():
         if self.transformation == 'svd_reconstruction':
             begin, end = list(map(int, self.param.split(',')))
             h, w = list(map(int, self.size.split(',')))
-            data = reconstruction.svd(img, [begin, end])
-            data = np.array(Image.fromarray(data).thumbnail((h, w)))
+            img_reconstructed = reconstruction.svd(img, [begin, end])
+            data_array = np.array(img_reconstructed, 'uint8')
+            data = np.array(Image.fromarray(data_array).thumbnail((h, w)))
 
         if self.transformation == 'ipca_reconstruction':
             n_components, batch_size = list(map(int, self.param.split(',')))
             h, w = list(map(int, self.size.split(',')))
-            data = reconstruction.ipca(img, n_components, batch_size)
-            data = np.array(Image.fromarray(data).thumbnail((h, w)))
+            img_reconstructed = reconstruction.ipca(img, n_components, batch_size)
+            data_array = np.array(img_reconstructed, 'uint8')
+            data = np.array(Image.fromarray(data_array).thumbnail((h, w)))
 
         if self.transformation == 'fast_ica_reconstruction':
             n_components = self.param
             h, w = list(map(int, self.size.split(',')))
-            data = reconstruction.fast_ica(img, n_components)
-            data = np.array(Image.fromarray(data).thumbnail((h, w)))
+            img_reconstructed = reconstruction.fast_ica(img, n_components)
+            data_array = np.array(img_reconstructed, 'uint8')
+            data = np.array(Image.fromarray(data_array).thumbnail((h, w)))
 
         if self.transformation == 'min_diff_filter':
             w_size, h_size = list(map(int, self.param.split(',')))