summaryrefslogtreecommitdiff
path: root/examples/da/plot_otda_mapping_colors_images.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/da/plot_otda_mapping_colors_images.py')
-rw-r--r--examples/da/plot_otda_mapping_colors_images.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/examples/da/plot_otda_mapping_colors_images.py b/examples/da/plot_otda_mapping_colors_images.py
index 6c024ea..a628b05 100644
--- a/examples/da/plot_otda_mapping_colors_images.py
+++ b/examples/da/plot_otda_mapping_colors_images.py
@@ -23,7 +23,7 @@ from scipy import ndimage
import matplotlib.pylab as pl
import ot
-np.random.seed(42)
+r = np.random.RandomState(42)
def im2mat(I):
@@ -54,8 +54,8 @@ X2 = im2mat(I2)
# training samples
nb = 1000
-idx1 = np.random.randint(X1.shape[0], size=(nb,))
-idx2 = np.random.randint(X2.shape[0], size=(nb,))
+idx1 = r.randint(X1.shape[0], size=(nb,))
+idx2 = r.randint(X2.shape[0], size=(nb,))
Xs = X1[idx1, :]
Xt = X2[idx2, :]
@@ -91,6 +91,7 @@ ot_mapping_gaussian.fit(Xs=Xs, Xt=Xt)
X1tn = ot_mapping_gaussian.transform(Xs=X1) # use the estimated mapping
Image_mapping_gaussian = minmax(mat2im(X1tn, I1.shape))
+
##############################################################################
# plot original images
##############################################################################
@@ -107,6 +108,7 @@ pl.axis('off')
pl.title('Image 2')
pl.tight_layout()
+
##############################################################################
# plot pixel values distribution
##############################################################################
@@ -128,6 +130,7 @@ pl.ylabel('Blue')
pl.title('Image 2')
pl.tight_layout()
+
##############################################################################
# plot transformed images
##############################################################################