Explorar el Código

Script to display data zones informations and scene added

Jerome Buisine hace 6 años
padre
commit
4c54b57fb4

+ 60 - 0
helpful_scripts/display_bits_shifted.py

@@ -0,0 +1,60 @@
+from ipfml import image_processing
+from PIL import Image
+import numpy as np
+from ipfml import metrics
+from skimage import color
+
+import cv2
+
+nb_bits = 3
+max_nb_bits = 8
+
+low_bits_svd_values = []
+
+def open_and_display(path, i):
+
+    img = Image.open(path)
+
+    block_used = np.array(img)
+
+    low_bits_block = image_processing.rgb_to_LAB_L_bits(block_used, (i + 1, i + nb_bits + 1))
+
+    low_bits_svd = metrics.get_SVD_s(low_bits_block)
+
+    low_bits_svd = [b / low_bits_svd[0] for b in low_bits_svd]
+
+    low_bits_svd_values[i].append(low_bits_svd)
+
+path_noisy = '/home/jbuisine/Documents/Thesis/Development/NoiseDetection_In_SynthesisImages/fichiersSVD_light/Cuisine01/cuisine01_00050.png'
+path_threshold = '/home/jbuisine/Documents/Thesis/Development/NoiseDetection_In_SynthesisImages/fichiersSVD_light/Cuisine01/cuisine01_00400.png'
+path_ref = '/home/jbuisine/Documents/Thesis/Development/NoiseDetection_In_SynthesisImages/fichiersSVD_light/Cuisine01/cuisine01_01200.png'
+
+path_list = [path_noisy, path_threshold, path_ref]
+
+
+for i in range(0, max_nb_bits - nb_bits + 1):
+
+    low_bits_svd_values.append([])
+    for p in path_list:
+        open_and_display(p, i)
+
+import matplotlib.pyplot as plt
+
+# SVD
+# make a little extra space between the subplots
+
+fig=plt.figure(figsize=(8, 8))
+
+for id, l in enumerate(low_bits_svd_values):
+
+     fig.add_subplot(3, 3, (id + 1))
+     plt.plot(l[0], label='Noisy')
+     plt.plot(l[1], label='Threshold')
+     plt.plot(l[2], label='Reference')
+     plt.title('Low ' + str(nb_bits) + ' bits SVD shifted by ' + str(id))
+     plt.ylabel('Low ' + str(nb_bits) + ' bits SVD values')
+     plt.xlabel('Vector features')
+     plt.legend(bbox_to_anchor=(0.7, 1), loc=2, borderaxespad=0.2)
+     plt.ylim(0, 0.1)
+
+plt.show()

+ 188 - 0
helpful_scripts/display_bits_shifted_scene.py

@@ -0,0 +1,188 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+"""
+Created on Fri Sep 14 21:02:42 2018
+
+@author: jbuisine
+"""
+
+from __future__ import print_function
+import sys, os, getopt
+import numpy as np
+import random
+import time
+import json
+
+from PIL import Image
+from ipfml import image_processing
+from ipfml import metrics
+from skimage import color
+import matplotlib.pyplot as plt
+
+config_filename   = "config"
+zone_folder       = "zone"
+min_max_filename  = "_min_max_values"
+
+# define all scenes values
+scenes_list = ['Appart1opt02', 'Bureau1', 'Cendrier', 'Cuisine01', 'EchecsBas', 'PNDVuePlongeante', 'SdbCentre', 'SdbDroite', 'Selles']
+scenes_indexes = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I']
+choices = ['svd', 'svdn', 'svdne']
+path = '../fichiersSVD_light'
+zones = np.arange(16)
+seuil_expe_filename = 'seuilExpe'
+
+metric_choices = ['lab', 'mscn', 'mscn_revisited', 'low_bits_2', 'low_bits_3', 'low_bits_4']
+
+max_nb_bits = 8
+
+def display_data_scenes(nb_bits, p_scene):
+    """
+    @brief Method which generates all .csv files from scenes photos
+    @param path - path of scenes folder information
+    @return nothing
+    """
+
+    scenes = os.listdir(path)
+    # remove min max file from scenes folder
+    scenes = [s for s in scenes if min_max_filename not in s]
+
+    # go ahead each scenes
+    for id_scene, folder_scene in enumerate(scenes):
+
+        if p_scene == folder_scene:
+            print(folder_scene)
+            scene_path = os.path.join(path, folder_scene)
+
+            config_file_path = os.path.join(scene_path, config_filename)
+
+            with open(config_file_path, "r") as config_file:
+                last_image_name = config_file.readline().strip()
+                prefix_image_name = config_file.readline().strip()
+                start_index_image = config_file.readline().strip()
+                end_index_image = config_file.readline().strip()
+                step_counter = int(config_file.readline().strip())
+
+            # construct each zones folder name
+            zones_folder = []
+
+            # get zones list info
+            for index in zones:
+                index_str = str(index)
+                if len(index_str) < 2:
+                    index_str = "0" + index_str
+
+                current_zone = "zone"+index_str
+                zones_folder.append(current_zone)
+
+            zones_images_data = []
+            threshold_info = []
+
+            for id_zone, zone_folder in enumerate(zones_folder):
+
+                zone_path = os.path.join(scene_path, zone_folder)
+
+                current_counter_index = int(start_index_image)
+                end_counter_index = int(end_index_image)
+
+                # get threshold information
+                path_seuil = os.path.join(zone_path, seuil_expe_filename)
+
+                # open treshold path and get this information
+                with open(path_seuil, "r") as seuil_file:
+                    seuil_learned = int(seuil_file.readline().strip())
+                    threshold_info.append(seuil_learned)
+
+            # compute mean threshold values
+            mean_threshold = sum(threshold_info) / float(len(threshold_info))
+
+            print(mean_threshold, "mean threshold found")
+            threshold_image_found = False
+
+            # find appropriate mean threshold picture
+            while(current_counter_index <= end_counter_index and not threshold_image_found):
+
+                if mean_threshold < int(current_counter_index):
+                    current_counter_index_str = str(current_counter_index)
+
+                    while len(start_index_image) > len(current_counter_index_str):
+                        current_counter_index_str = "0" + current_counter_index_str
+
+                    threshold_image_found = True
+                    threshold_image_zone = current_counter_index_str
+
+                current_counter_index += step_counter
+
+            # all indexes of picture to plot
+            images_indexes = [start_index_image, threshold_image_zone, end_index_image]
+            images_data = []
+
+            print(images_indexes)
+
+            low_bits_svd_values = []
+
+            for i in range(0, max_nb_bits - nb_bits + 1):
+
+                low_bits_svd_values.append([])
+
+                for index in images_indexes:
+
+                    img_path = os.path.join(scene_path, prefix_image_name + index + ".png")
+
+                    current_img = Image.open(img_path)
+
+                    block_used = np.array(current_img)
+
+                    low_bits_block = image_processing.rgb_to_LAB_L_bits(block_used, (i + 1, i + nb_bits + 1))
+                    low_bits_svd = metrics.get_SVD_s(low_bits_block)
+                    low_bits_svd = [b / low_bits_svd[0] for b in low_bits_svd]
+                    low_bits_svd_values[i].append(low_bits_svd)
+
+
+            fig=plt.figure(figsize=(8, 8))
+            fig.suptitle("Lab SVD " + str(nb_bits) +  " bits values shifted for " + p_scene + " scene", fontsize=20)
+
+            for id, data in enumerate(low_bits_svd_values):
+                fig.add_subplot(3, 3, (id + 1))
+                plt.plot(data[0], label='Noisy_' + start_index_image)
+                plt.plot(data[1], label='Threshold_' + threshold_image_zone)
+                plt.plot(data[2], label='Reference_' + end_index_image)
+                plt.ylabel('Lab SVD ' + str(nb_bits) + ' bits values shifted by ' + str(id), fontsize=14)
+                plt.xlabel('Vector features', fontsize=16)
+                plt.legend(bbox_to_anchor=(0.5, 1), loc=2, borderaxespad=0.2, fontsize=14)
+                plt.ylim(0, 0.1)
+            plt.show()
+
+def main():
+
+    if len(sys.argv) <= 1:
+        print('Run with default parameters...')
+        print('python generate_all_data.py --bits 3 --scene A')
+        sys.exit(2)
+    try:
+        opts, args = getopt.getopt(sys.argv[1:], "hb:s", ["help=", "bits=", "scene="])
+    except getopt.GetoptError:
+        # print help information and exit:
+        print('python generate_all_data.py --bits 4 --scene A')
+        sys.exit(2)
+    for o, a in opts:
+        if o == "-h":
+            print('python generate_all_data.py --bits 4 --scene A')
+            sys.exit()
+        elif o in ("-b", "--bits"):
+            p_bits = int(a)
+
+        elif o in ("-s", "--scene"):
+            p_scene = a
+
+            if p_scene not in scenes_indexes:
+                assert False, "Invalid metric choice"
+            else:
+                    p_scene = scenes_list[scenes_indexes.index(p_scene)]
+        else:
+            assert False, "unhandled option"
+
+
+    display_data_scenes(p_bits, p_scene)
+
+if __name__== "__main__":
+    main()

+ 146 - 0
helpful_scripts/display_bits_values.py

@@ -0,0 +1,146 @@
+from ipfml import image_processing
+from PIL import Image
+import numpy as np
+from ipfml import metrics
+from skimage import color
+
+import cv2
+
+low_bits_2_svd_values = []
+
+low_bits_3_svd_values = []
+
+low_bits_4_svd_values = []
+
+low_bits_5_svd_values = []
+
+low_bits_6_svd_values = []
+
+low_bits_7_svd_values = []
+
+def open_and_display(path):
+    img = Image.open(path)
+
+    block_used = np.array(img)
+
+    # computation of low bits parts 2 bits
+    low_bits_block = image_processing.rgb_to_LAB_L_low_bits(block_used, 3)
+
+    low_bits_svd = metrics.get_SVD_s(low_bits_block)
+
+    low_bits_svd = [b / low_bits_svd[0] for b in low_bits_svd]
+
+    low_bits_2_svd_values.append(low_bits_svd)
+
+    # computation of low bits parts 3 bits
+    low_bits_block = image_processing.rgb_to_LAB_L_low_bits(block_used, 7)
+
+    low_bits_svd = metrics.get_SVD_s(low_bits_block)
+
+    low_bits_svd = [b / low_bits_svd[0] for b in low_bits_svd]
+
+    low_bits_3_svd_values.append(low_bits_svd)
+
+    # computation of low bits parts 4 bits
+    low_bits_block = image_processing.rgb_to_LAB_L_low_bits(block_used)
+
+    low_bits_svd = metrics.get_SVD_s(low_bits_block)
+
+    low_bits_svd = [b / low_bits_svd[0] for b in low_bits_svd]
+
+    low_bits_4_svd_values.append(low_bits_svd)
+
+    # computation of low bits parts 5 bits
+    low_bits_block = image_processing.rgb_to_LAB_L_low_bits(block_used, 31)
+
+    low_bits_svd = metrics.get_SVD_s(low_bits_block)
+
+    low_bits_svd = [b / low_bits_svd[0] for b in low_bits_svd]
+
+    low_bits_5_svd_values.append(low_bits_svd)
+
+    # computation of low bits parts 6 bits
+    low_bits_block = image_processing.rgb_to_LAB_L_low_bits(block_used, 63)
+
+    low_bits_svd = metrics.get_SVD_s(low_bits_block)
+
+    low_bits_svd = [b / low_bits_svd[0] for b in low_bits_svd]
+
+    low_bits_6_svd_values.append(low_bits_svd)
+
+    # computation of low bits parts 7 bits
+    low_bits_block = image_processing.rgb_to_LAB_L_low_bits(block_used, 127)
+
+    low_bits_svd = metrics.get_SVD_s(low_bits_block)
+
+    low_bits_svd = [b / low_bits_svd[0] for b in low_bits_svd]
+
+    low_bits_7_svd_values.append(low_bits_svd)
+
+path_noisy = '/home/jbuisine/Documents/Thesis/Development/NoiseDetection_In_SynthesisImages/fichiersSVD_light/Cuisine01/cuisine01_00050.png'
+path_threshold = '/home/jbuisine/Documents/Thesis/Development/NoiseDetection_In_SynthesisImages/fichiersSVD_light/Cuisine01/cuisine01_00400.png'
+path_ref = '/home/jbuisine/Documents/Thesis/Development/NoiseDetection_In_SynthesisImages/fichiersSVD_light/Cuisine01/cuisine01_01200.png'
+
+path_list = [path_noisy, path_threshold, path_ref]
+
+for p in path_list:
+    open_and_display(p)
+
+import matplotlib.pyplot as plt
+
+# SVD
+# make a little extra space between the subplots
+
+plt.plot(low_bits_2_svd_values[0], label='Noisy')
+plt.plot(low_bits_2_svd_values[1], label='Threshold')
+plt.plot(low_bits_2_svd_values[2], label='Reference')
+plt.ylabel('Low 2 bits SVD')
+plt.xlabel('Vector features')
+plt.legend(bbox_to_anchor=(0.7, 1), loc=2, borderaxespad=0.2)
+plt.ylim(0, 0.1)
+plt.show()
+
+plt.plot(low_bits_3_svd_values[0], label='Noisy')
+plt.plot(low_bits_3_svd_values[1], label='Threshold')
+plt.plot(low_bits_3_svd_values[2], label='Reference')
+plt.ylabel('Low 3 bits SVD')
+plt.xlabel('Vector features')
+plt.legend(bbox_to_anchor=(0.7, 1), loc=2, borderaxespad=0.2)
+plt.ylim(0, 0.1)
+plt.show()
+
+plt.plot(low_bits_4_svd_values[0], label='Noisy')
+plt.plot(low_bits_4_svd_values[1], label='Threshold')
+plt.plot(low_bits_4_svd_values[2], label='Reference')
+plt.ylabel('Low 4 bits SVD')
+plt.xlabel('Vector features')
+plt.legend(bbox_to_anchor=(0.7, 1), loc=2, borderaxespad=0.2)
+plt.ylim(0, 0.1)
+plt.show()
+
+plt.plot(low_bits_5_svd_values[0], label='Noisy')
+plt.plot(low_bits_5_svd_values[1], label='Threshold')
+plt.plot(low_bits_5_svd_values[2], label='Reference')
+plt.ylabel('Low 5 bits SVD')
+plt.xlabel('Vector features')
+plt.legend(bbox_to_anchor=(0.7, 1), loc=2, borderaxespad=0.2)
+plt.ylim(0, 0.1)
+plt.show()
+
+plt.plot(low_bits_6_svd_values[0], label='Noisy')
+plt.plot(low_bits_6_svd_values[1], label='Threshold')
+plt.plot(low_bits_6_svd_values[2], label='Reference')
+plt.ylabel('Low 6 bits SVD')
+plt.xlabel('Vector features')
+plt.legend(bbox_to_anchor=(0.7, 1), loc=2, borderaxespad=0.2)
+plt.ylim(0, 0.1)
+plt.show()
+
+plt.plot(low_bits_7_svd_values[0], label='Noisy')
+plt.plot(low_bits_7_svd_values[1], label='Threshold')
+plt.plot(low_bits_7_svd_values[2], label='Reference')
+plt.ylabel('Low 7 bits SVD')
+plt.xlabel('Vector features')
+plt.legend(bbox_to_anchor=(0.7, 1), loc=2, borderaxespad=0.2)
+plt.ylim(0, 0.1)
+plt.show()

+ 251 - 0
helpful_scripts/display_scenes_zones.py

@@ -0,0 +1,251 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+"""
+Created on Fri Sep 14 21:02:42 2018
+
+@author: jbuisine
+"""
+
+from __future__ import print_function
+import sys, os, getopt
+import numpy as np
+import random
+import time
+import json
+
+from PIL import Image
+from ipfml import image_processing
+from ipfml import metrics
+from skimage import color
+import matplotlib.pyplot as plt
+
+config_filename   = "config"
+zone_folder       = "zone"
+min_max_filename  = "_min_max_values"
+
+# define all scenes values
+scenes_list = ['Appart1opt02', 'Bureau1', 'Cendrier', 'Cuisine01', 'EchecsBas', 'PNDVuePlongeante', 'SdbCentre', 'SdbDroite', 'Selles']
+scenes_indexes = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I']
+choices = ['svd', 'svdn', 'svdne']
+path = '../fichiersSVD_light'
+zones = np.arange(16)
+seuil_expe_filename = 'seuilExpe'
+
+metric_choices = ['lab', 'mscn', 'mscn_revisited', 'low_bits_2', 'low_bits_3', 'low_bits_4', 'low_bits_5', 'low_bits_6']
+
+def display_data_scenes(data_type, p_scene):
+    """
+    @brief Method which generates all .csv files from scenes photos
+    @param path - path of scenes folder information
+    @return nothing
+    """
+
+    scenes = os.listdir(path)
+    # remove min max file from scenes folder
+    scenes = [s for s in scenes if min_max_filename not in s]
+
+    # go ahead each scenes
+    for id_scene, folder_scene in enumerate(scenes):
+
+        if p_scene == folder_scene:
+            print(folder_scene)
+            scene_path = os.path.join(path, folder_scene)
+
+            config_file_path = os.path.join(scene_path, config_filename)
+
+            with open(config_file_path, "r") as config_file:
+                last_image_name = config_file.readline().strip()
+                prefix_image_name = config_file.readline().strip()
+                start_index_image = config_file.readline().strip()
+                end_index_image = config_file.readline().strip()
+                step_counter = int(config_file.readline().strip())
+
+            # construct each zones folder name
+            zones_folder = []
+
+            # get zones list info
+            for index in zones:
+                index_str = str(index)
+                if len(index_str) < 2:
+                    index_str = "0" + index_str
+
+                current_zone = "zone"+index_str
+                zones_folder.append(current_zone)
+
+            zones_images_data = []
+            threshold_info = []
+
+            for id_zone, zone_folder in enumerate(zones_folder):
+
+                zone_path = os.path.join(scene_path, zone_folder)
+
+                current_counter_index = int(start_index_image)
+                end_counter_index = int(end_index_image)
+
+                # get threshold information
+                path_seuil = os.path.join(zone_path, seuil_expe_filename)
+
+                # open treshold path and get this information
+                with open(path_seuil, "r") as seuil_file:
+                    seuil_learned = int(seuil_file.readline().strip())
+
+                threshold_image_found = False
+                while(current_counter_index <= end_counter_index and not threshold_image_found):
+
+                    if seuil_learned < int(current_counter_index):
+                        current_counter_index_str = str(current_counter_index)
+
+                        while len(start_index_image) > len(current_counter_index_str):
+                            current_counter_index_str = "0" + current_counter_index_str
+
+                        threshold_image_found = True
+                        threshold_image_zone = current_counter_index_str
+                        threshold_info.append(threshold_image_zone)
+
+                    current_counter_index += step_counter
+
+                # all indexes of picture to plot
+                images_indexes = [start_index_image, threshold_image_zone, end_index_image]
+                images_data = []
+
+                print(images_indexes)
+
+                for index in images_indexes:
+
+                    img_path = os.path.join(scene_path, prefix_image_name + index + ".png")
+
+                    current_img = Image.open(img_path)
+                    img_blocks = image_processing.divide_in_blocks(current_img, (200, 200))
+
+                    # getting expected block id
+                    block = img_blocks[id_zone]
+
+                    # get data from mode
+                    # Here you can add the way you compute data
+                    if data_type == 'lab':
+
+                        block_file_path = '/tmp/lab_img.png'
+                        block.save(block_file_path)
+                        data = image_processing.get_LAB_L_SVD_s(Image.open(block_file_path))
+
+                    if data_type == 'mscn_revisited':
+
+                        img_mscn_revisited = image_processing.rgb_to_mscn(block)
+
+                        # save tmp as img
+                        img_output = Image.fromarray(img_mscn_revisited.astype('uint8'), 'L')
+                        mscn_revisited_file_path = '/tmp/mscn_revisited_img.png'
+                        img_output.save(mscn_revisited_file_path)
+                        img_block = Image.open(mscn_revisited_file_path)
+
+                        # extract from temp image
+                        data = metrics.get_SVD_s(img_block)
+
+                    if data_type == 'mscn':
+
+                        img_gray = np.array(color.rgb2gray(np.asarray(block))*255, 'uint8')
+                        img_mscn = image_processing.calculate_mscn_coefficients(img_gray, 7)
+                        img_mscn_norm = image_processing.normalize_2D_arr(img_mscn)
+
+                        img_mscn_gray = np.array(img_mscn_norm*255, 'uint8')
+
+                        data = metrics.get_SVD_s(img_mscn_gray)
+
+                    if data_type == 'low_bits_6':
+
+                        low_bits_6 = image_processing.rgb_to_LAB_L_low_bits(block, 63)
+
+                        # extract from temp image
+                        data = metrics.get_SVD_s(low_bits_6)
+
+
+                    if data_type == 'low_bits_5':
+
+                        low_bits_5 = image_processing.rgb_to_LAB_L_low_bits(block, 31)
+
+                        # extract from temp image
+                        data = metrics.get_SVD_s(low_bits_5)
+
+
+                    if data_type == 'low_bits_4':
+
+                        low_bits_4 = image_processing.rgb_to_LAB_L_low_bits(block)
+
+                        # extract from temp image
+                        data = metrics.get_SVD_s(low_bits_4)
+
+                    if data_type == 'low_bits_3':
+
+                        low_bits_3 = image_processing.rgb_to_LAB_L_low_bits(block, 7)
+
+                        # extract from temp image
+                        data = metrics.get_SVD_s(low_bits_3)
+
+                    if data_type == 'low_bits_2':
+
+                        low_bits_2 = image_processing.rgb_to_LAB_L_low_bits(block, 3)
+
+                        # extract from temp image
+                        data = metrics.get_SVD_s(low_bits_2)
+
+                    ##################
+                    # Data mode part #
+                    ##################
+
+                    # modify data depending mode
+                    data = image_processing.normalize_arr(data)
+                    images_data.append(data)
+
+                zones_images_data.append(images_data)
+
+            fig=plt.figure(figsize=(8, 8))
+            fig.suptitle(data_type + " values for " + p_scene + " scene", fontsize=20)
+
+            for id, data in enumerate(zones_images_data):
+                fig.add_subplot(4, 4, (id + 1))
+                plt.plot(data[0], label='Noisy_' + start_index_image)
+                plt.plot(data[1], label='Threshold_' + threshold_info[id])
+                plt.plot(data[2], label='Reference_' + end_index_image)
+                plt.ylabel(data_type + ' SVD, ZONE_' + str(id + 1), fontsize=14)
+                plt.xlabel('Vector features', fontsize=16)
+                plt.legend(bbox_to_anchor=(0.5, 1), loc=2, borderaxespad=0.2, fontsize=14)
+                plt.ylim(0, 0.1)
+            plt.show()
+
+def main():
+
+    if len(sys.argv) <= 1:
+        print('Run with default parameters...')
+        print('python generate_all_data.py --metric all --scene A')
+        print('python generate_all_data.py --metric lab --scene A')
+        sys.exit(2)
+    try:
+        opts, args = getopt.getopt(sys.argv[1:], "hm", ["help=", "metric=", "scene="])
+    except getopt.GetoptError:
+        # print help information and exit:
+        print('python generate_all_data.py --metric all --scene A')
+        sys.exit(2)
+    for o, a in opts:
+        if o == "-h":
+            print('python generate_all_data.py --metric all --scene A')
+            sys.exit()
+        elif o in ("-m", "--metric"):
+            p_metric = a
+
+            if p_metric != 'all' and p_metric not in metric_choices:
+                assert False, "Invalid metric choice"
+        elif o in ("-s", "--scene"):
+            p_scene = a
+
+            if p_scene not in scenes_indexes:
+                assert False, "Invalid metric choice"
+            else:
+                p_scene = scenes_list[scenes_indexes.index(p_scene)]
+        else:
+            assert False, "unhandled option"
+
+
+    display_data_scenes(p_metric, p_scene)
+
+if __name__== "__main__":
+    main()

+ 189 - 0
helpful_scripts/display_scenes_zones_shifted.py

@@ -0,0 +1,189 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+"""
+Created on Fri Sep 14 21:02:42 2018
+
+@author: jbuisine
+"""
+
+from __future__ import print_function
+import sys, os, getopt
+import numpy as np
+import random
+import time
+import json
+
+from PIL import Image
+from ipfml import image_processing
+from ipfml import metrics
+from skimage import color
+import matplotlib.pyplot as plt
+
+config_filename   = "config"
+zone_folder       = "zone"
+min_max_filename  = "_min_max_values"
+
+# define all scenes values
+scenes_list = ['Appart1opt02', 'Bureau1', 'Cendrier', 'Cuisine01', 'EchecsBas', 'PNDVuePlongeante', 'SdbCentre', 'SdbDroite', 'Selles']
+scenes_indexes = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I']
+choices = ['svd', 'svdn', 'svdne']
+path = '../fichiersSVD_light'
+zones = np.arange(16)
+seuil_expe_filename = 'seuilExpe'
+
+max_nb_bits = 8
+
+def display_data_scenes(p_scene, p_bits, p_shifted):
+    """
+    @brief Method which generates all .csv files from scenes photos
+    @param path - path of scenes folder information
+    @return nothing
+    """
+
+    scenes = os.listdir(path)
+    # remove min max file from scenes folder
+    scenes = [s for s in scenes if min_max_filename not in s]
+
+    # go ahead each scenes
+    for id_scene, folder_scene in enumerate(scenes):
+
+        if p_scene == folder_scene:
+            print(folder_scene)
+            scene_path = os.path.join(path, folder_scene)
+
+            config_file_path = os.path.join(scene_path, config_filename)
+
+            with open(config_file_path, "r") as config_file:
+                last_image_name = config_file.readline().strip()
+                prefix_image_name = config_file.readline().strip()
+                start_index_image = config_file.readline().strip()
+                end_index_image = config_file.readline().strip()
+                step_counter = int(config_file.readline().strip())
+
+            # construct each zones folder name
+            zones_folder = []
+
+            # get zones list info
+            for index in zones:
+                index_str = str(index)
+                if len(index_str) < 2:
+                    index_str = "0" + index_str
+
+                current_zone = "zone"+index_str
+                zones_folder.append(current_zone)
+
+            zones_images_data = []
+            threshold_info = []
+
+            for id_zone, zone_folder in enumerate(zones_folder):
+
+                zone_path = os.path.join(scene_path, zone_folder)
+
+                current_counter_index = int(start_index_image)
+                end_counter_index = int(end_index_image)
+
+                # get threshold information
+                path_seuil = os.path.join(zone_path, seuil_expe_filename)
+
+                # open treshold path and get this information
+                with open(path_seuil, "r") as seuil_file:
+                    seuil_learned = int(seuil_file.readline().strip())
+
+                threshold_image_found = False
+                while(current_counter_index <= end_counter_index and not threshold_image_found):
+
+                    if seuil_learned < int(current_counter_index):
+                        current_counter_index_str = str(current_counter_index)
+
+                        while len(start_index_image) > len(current_counter_index_str):
+                            current_counter_index_str = "0" + current_counter_index_str
+
+                        threshold_image_found = True
+                        threshold_image_zone = current_counter_index_str
+                        threshold_info.append(threshold_image_zone)
+
+                    current_counter_index += step_counter
+
+                # all indexes of picture to plot
+                images_indexes = [start_index_image, threshold_image_zone, end_index_image]
+                images_data = []
+
+                print(images_indexes)
+
+                for index in images_indexes:
+
+                    img_path = os.path.join(scene_path, prefix_image_name + index + ".png")
+
+                    current_img = Image.open(img_path)
+                    img_blocks = image_processing.divide_in_blocks(current_img, (200, 200))
+
+                    # getting expected block id
+                    block = img_blocks[id_zone]
+
+                    # get data from mode
+                    # Here you can add the way you compute data
+                    low_bits_block = image_processing.rgb_to_LAB_L_bits(block, (p_shifted + 1, p_shifted + p_bits + 1))
+                    data = metrics.get_SVD_s(low_bits_block)
+
+                    ##################
+                    # Data mode part #
+                    ##################
+
+                    # modify data depending mode
+                    data = image_processing.normalize_arr(data)
+                    images_data.append(data)
+
+                zones_images_data.append(images_data)
+
+            fig=plt.figure(figsize=(8, 8))
+            fig.suptitle('Lab SVD ' + str(p_bits) + ' bits shifted by ' + str(p_shifted) + " for " + p_scene + " scene", fontsize=20)
+
+            for id, data in enumerate(zones_images_data):
+                fig.add_subplot(4, 4, (id + 1))
+                plt.plot(data[0], label='Noisy_' + start_index_image)
+                plt.plot(data[1], label='Threshold_' + threshold_info[id])
+                plt.plot(data[2], label='Reference_' + end_index_image)
+                plt.ylabel('Lab SVD ' + str(p_bits) + ' bits shifted by ' + str(p_shifted) + ', ZONE_' + str(id + 1), fontsize=14)
+                plt.xlabel('Vector features', fontsize=16)
+                plt.legend(bbox_to_anchor=(0.5, 1), loc=2, borderaxespad=0.2, fontsize=14)
+                plt.ylim(0, 0.1)
+            plt.show()
+
+def main():
+
+    if len(sys.argv) <= 1:
+        print('Run with default parameters...')
+        print('python generate_all_data.py --scene A --bits 3 --shifted 3')
+        sys.exit(2)
+    try:
+        opts, args = getopt.getopt(sys.argv[1:], "hs:b:s", ["help=", "scene=", "bits=", "shifted="])
+    except getopt.GetoptError:
+        # print help information and exit:
+        print('python generate_all_data.py --scene A --bits 3 --shifted 3')
+        sys.exit(2)
+    for o, a in opts:
+        if o == "-h":
+            print('python generate_all_data.py --scene A --bits 3 --shifted 3')
+            sys.exit()
+        elif o in ("-b", "--bits"):
+            p_bits = int(a)
+
+        elif o in ("-s", "--scene"):
+            p_scene = a
+
+            if p_scene not in scenes_indexes:
+                assert False, "Invalid metric choice"
+            else:
+                p_scene = scenes_list[scenes_indexes.index(p_scene)]
+        elif o in ("-f", "--shifted"):
+            p_shifted = int(a)
+        else:
+            assert False, "unhandled option"
+
+    if p_bits + p_shifted > max_nb_bits:
+        assert False, "Invalid parameters, cannot have bits greater than 8 after shift move"
+
+    display_data_scenes(p_scene, p_bits, p_shifted)
+
+if __name__== "__main__":
+    main()

+ 164 - 0
helpful_scripts/display_svd_values.py

@@ -0,0 +1,164 @@
+from ipfml import image_processing
+from PIL import Image
+import numpy as np
+from ipfml import metrics
+from skimage import color
+
+import cv2
+
+low_bits_2_svd_values = []
+
+low_bits_3_svd_values = []
+
+low_bits_4_svd_values = []
+
+mscn_revisited_svd_values = []
+
+mscn_svd_values = []
+
+lab_svd_values = []
+
+def open_and_display(path):
+    img = Image.open(path)
+
+    block_used = np.array(img)
+
+    img_mscn = image_processing.rgb_to_mscn(block_used)
+
+    #img_mscn_norm = image_processing.normalize_2D_arr(img_mscn)
+
+    #print(img_mscn)
+    img_output = img_mscn.astype('uint8')
+
+    print('-------------------------')
+
+    # MSCN part computation
+    mscn_s = metrics.get_SVD_s(img_output)
+
+    mscn_s = [m / mscn_s[0] for m in mscn_s]
+
+    mscn_revisited_svd_values.append(mscn_s)
+
+    # LAB part computation
+    path_block_img = '/tmp/lab_img.png'
+
+    img_used_pil = Image.fromarray(block_used.astype('uint8'), 'RGB')
+    img_used_pil.save(path_block_img)
+
+    lab_s = image_processing.get_LAB_L_SVD_s(Image.open(path_block_img))
+
+    lab_s = [l / lab_s[0] for l in lab_s]
+    lab_svd_values.append(lab_s)
+
+    # computation of low bits parts 2 bits
+    low_bits_block = image_processing.rgb_to_LAB_L_low_bits(block_used, 3)
+
+    low_bits_svd = metrics.get_SVD_s(low_bits_block)
+
+    low_bits_svd = [b / low_bits_svd[0] for b in low_bits_svd]
+
+    low_bits_2_svd_values.append(low_bits_svd)
+
+    # computation of low bits parts 3 bits
+    low_bits_block = image_processing.rgb_to_LAB_L_low_bits(block_used, 7)
+
+    low_bits_svd = metrics.get_SVD_s(low_bits_block)
+
+    low_bits_svd = [b / low_bits_svd[0] for b in low_bits_svd]
+
+    low_bits_3_svd_values.append(low_bits_svd)
+
+    # computation of low bits parts 4 bits
+    low_bits_block = image_processing.rgb_to_LAB_L_low_bits(block_used)
+
+    low_bits_svd = metrics.get_SVD_s(low_bits_block)
+
+    low_bits_svd = [b / low_bits_svd[0] for b in low_bits_svd]
+
+    low_bits_4_svd_values.append(low_bits_svd)
+
+    # Other MSCN
+    img_grey = np.array(color.rgb2gray(np.asarray(block_used))*255, 'uint8')
+
+
+    img_mscn_in_grey = np.array(image_processing.normalize_2D_arr(image_processing.calculate_mscn_coefficients(img_grey, 7))*255, 'uint8')
+    svd_s_values = metrics.get_SVD_s(img_mscn_in_grey)
+
+    svd_s_values = [s / svd_s_values[0] for s in svd_s_values]
+    mscn_svd_values.append(svd_s_values)
+
+
+
+
+#path_noisy = '/home/jbuisine/Documents/Thesis/Development/NoiseDetection_In_SynthesisImages/fichiersSVD_light/Appart1opt02/appartAopt_00020.png'
+#path_threshold = '/home/jbuisine/Documents/Thesis/Development/NoiseDetection_In_SynthesisImages/fichiersSVD_light/Appart1opt02/appartAopt_00300.png'
+#path_ref = '/home/jbuisine/Documents/Thesis/Development/NoiseDetection_In_SynthesisImages/fichiersSVD_light/Appart1opt02/appartAopt_00900.png'
+
+path_noisy = '/home/jbuisine/Documents/Thesis/Development/NoiseDetection_In_SynthesisImages/fichiersSVD_light/Cuisine01/cuisine01_00050.png'
+path_threshold = '/home/jbuisine/Documents/Thesis/Development/NoiseDetection_In_SynthesisImages/fichiersSVD_light/Cuisine01/cuisine01_00400.png'
+path_ref = '/home/jbuisine/Documents/Thesis/Development/NoiseDetection_In_SynthesisImages/fichiersSVD_light/Cuisine01/cuisine01_01200.png'
+
+
+path_list = [path_noisy, path_threshold, path_ref]
+
+for p in path_list:
+    open_and_display(p)
+
+import matplotlib.pyplot as plt
+
+# SVD
+# make a little extra space between the subplots
+
+plt.plot(lab_svd_values[0], label='Noisy')
+plt.plot(lab_svd_values[1], label='Threshold')
+plt.plot(lab_svd_values[2], label='Reference')
+plt.ylabel('LAB SVD')
+plt.xlabel('Vector features')
+plt.legend(bbox_to_anchor=(0.7, 1), loc=2, borderaxespad=0.2)
+plt.ylim(0, 0.1)
+plt.show()
+
+plt.plot(mscn_svd_values[0], label='Noisy')
+plt.plot(mscn_svd_values[1], label='Threshold')
+plt.plot(mscn_svd_values[2], label='Reference')
+plt.ylabel('MSCN SVD')
+plt.xlabel('Vector features')
+plt.legend(bbox_to_anchor=(0.7, 1), loc=2, borderaxespad=0.2)
+plt.ylim(0, 0.1)
+plt.show()
+
+plt.plot(mscn_revisited_svd_values[0], label='Noisy')
+plt.plot(mscn_revisited_svd_values[1], label='Threshold')
+plt.plot(mscn_revisited_svd_values[2], label='Reference')
+plt.ylabel('Revisited MSCN SVD')
+plt.xlabel('Vector features')
+plt.legend(bbox_to_anchor=(0.7, 1), loc=2, borderaxespad=0.2)
+plt.ylim(0, 0.1)
+plt.show()
+
+plt.plot(low_bits_2_svd_values[0], label='Noisy')
+plt.plot(low_bits_2_svd_values[1], label='Threshold')
+plt.plot(low_bits_2_svd_values[2], label='Reference')
+plt.ylabel('Low 2 bits SVD')
+plt.xlabel('Vector features')
+plt.legend(bbox_to_anchor=(0.7, 1), loc=2, borderaxespad=0.2)
+plt.ylim(0, 0.1)
+plt.show()
+
+plt.plot(low_bits_3_svd_values[0], label='Noisy')
+plt.plot(low_bits_3_svd_values[1], label='Threshold')
+plt.plot(low_bits_3_svd_values[2], label='Reference')
+plt.ylabel('Low 3 bits SVD')
+plt.xlabel('Vector features')
+plt.legend(bbox_to_anchor=(0.7, 1), loc=2, borderaxespad=0.2)
+plt.ylim(0, 0.1)
+plt.show()
+
+plt.plot(low_bits_4_svd_values[0], label='Noisy')
+plt.plot(low_bits_4_svd_values[1], label='Threshold')
+plt.plot(low_bits_4_svd_values[2], label='Reference')
+plt.ylabel('Low 4 bits SVD')
+plt.xlabel('Vector features')
+plt.legend(bbox_to_anchor=(0.7, 1), loc=2, borderaxespad=0.2)
+plt.ylim(0, 0.1)
+plt.show()

+ 37 - 0
helpful_scripts/show_mscn.py

@@ -0,0 +1,37 @@
+from ipfml import image_processing
+from PIL import Image
+import numpy as np
+from ipfml import metrics
+from skimage import color
+
+import cv2
+
+path_noisy = '/home/jbuisine/Documents/Thesis/Development/NoiseDetection_In_SynthesisImages/fichiersSVD_light/Cuisine01/cuisine01_00050.png'
+path_threshold = '/home/jbuisine/Documents/Thesis/Development/NoiseDetection_In_SynthesisImages/fichiersSVD_light/Cuisine01/cuisine01_00400.png'
+path_ref = '/home/jbuisine/Documents/Thesis/Development/NoiseDetection_In_SynthesisImages/fichiersSVD_light/Cuisine01/cuisine01_01200.png'
+
+path_list = [path_noisy, path_threshold, path_ref]
+labels = ['noisy', 'threshold', 'reference']
+
+for id, p in enumerate(path_list):
+
+    img = Image.open(p)
+    img.show()
+
+    # Revisited MSCN
+    current_img_mscn = image_processing.rgb_to_mscn(img)
+    current_img_output = current_img_mscn.astype('uint8')
+    img_mscn_pil = Image.fromarray(current_img_output.astype('uint8'), 'L')
+    img_mscn_pil.show()
+    img_mscn_pil.save('/home/jbuisine/Downloads/' + labels[id] + '_revisited.png')
+
+
+    # MSCN
+    img_grey = np.array(color.rgb2gray(np.asarray(img))*255, 'uint8')
+
+    img_mscn_in_grey = np.array(image_processing.normalize_2D_arr(image_processing.calculate_mscn_coefficients(img_grey, 7))*255, 'uint8')
+
+    img_mscn_pil = Image.fromarray(img_mscn_in_grey.astype('uint8'), 'L')
+    img_mscn_pil.show()
+    img_mscn_pil.save('/home/jbuisine/Downloads/' + labels[id] + '_mscn.png')
+

+ 241 - 0
helpful_scripts/test_mscn.py

@@ -0,0 +1,241 @@
+from ipfml import image_processing
+from PIL import Image
+import numpy as np
+from ipfml import metrics
+from skimage import color
+
+import cv2
+
+low_bits_svd_values_norm = []
+low_bits_svd_values_norm_together = []
+low_bits_svd_values = []
+
+mscn_svd_values_norm = []
+mscn_svd_values_norm_together = []
+mscn_svd_values = []
+
+lab_svd_values_norm = []
+lab_svd_values_norm_together = []
+lab_svd_values = []
+
+def open_and_display(path):
+    img = Image.open(path)
+
+    blocks = image_processing.divide_in_blocks(img, (200, 200), False)
+
+    block_used = blocks[11]
+
+    img_mscn = image_processing.rgb_to_mscn(block_used)
+
+    #img_mscn_norm = image_processing.normalize_2D_arr(img_mscn)
+
+    #print(img_mscn)
+    img_output = img_mscn.astype('uint8')
+
+    print('-------------------------')
+
+    # MSCN part computation
+    mscn_s = metrics.get_SVD_s(img_output)
+
+    mscn_svd_values.append(mscn_s)
+    mscn_svd_values_norm.append(image_processing.normalize_arr(mscn_s))
+
+    mscn_min_val = 10000000
+    mscn_max_val = 0
+
+     # check for each block of image
+    for block in blocks:
+
+        current_img_mscn = image_processing.rgb_to_mscn(block)
+
+        current_img_output = img_mscn.astype('uint8')
+
+        # MSCN part computation
+        current_mscn_s = metrics.get_SVD_s(img_output)
+
+        current_min = current_mscn_s.min()
+        current_max = current_mscn_s.max()
+
+        if current_min < mscn_min_val:
+            mscn_min_val = current_min
+
+        if current_max > mscn_max_val:
+            mscn_max_val = current_max
+
+    mscn_svd_values_norm_together.append(image_processing.normalize_arr_with_range(mscn_s, mscn_min_val, mscn_max_val))
+
+    # LAB part computation
+    path_block_img = '/tmp/lab_img.png'
+
+    img_used_pil = Image.fromarray(block_used.astype('uint8'), 'RGB')
+    img_used_pil.save(path_block_img)
+
+    #img_used_pil.show()
+
+    lab_s = image_processing.get_LAB_L_SVD_s(Image.open(path_block_img))
+
+    lab_svd_values.append(lab_s)
+    lab_svd_values_norm.append(image_processing.normalize_arr(lab_s))
+
+    lab_min_val = 10000000
+    lab_max_val = 0
+
+    # check for each block of image
+    for block in blocks:
+
+        current_img_used_pil = Image.fromarray(block.astype('uint8'), 'RGB')
+        current_img_used_pil.save(path_block_img)
+
+        current_lab_s = image_processing.get_LAB_L_SVD_s(Image.open(path_block_img))
+
+        current_min = current_lab_s.min()
+        current_max = current_lab_s.max()
+
+        if current_min < lab_min_val:
+            lab_min_val = current_min
+
+        if current_max > lab_max_val:
+            lab_max_val = current_max
+
+    lab_svd_values_norm_together.append(image_processing.normalize_arr_with_range(lab_s, lab_min_val, lab_max_val))
+
+    # computation of low bits parts
+    low_bits_block = image_processing.rgb_to_grey_low_bits(block_used)
+
+    low_bits_svd = metrics.get_SVD_s(low_bits_block)
+
+    low_bits_svd_values.append(low_bits_svd)
+    low_bits_svd_values_norm.append(image_processing.normalize_arr(low_bits_svd))
+
+    low_bits_min_val = 10000000
+    low_bits_max_val = 0
+
+
+        # check for each block of image
+    for block in blocks:
+
+        current_grey_block = np.array(color.rgb2gray(block)*255, 'uint8')
+        current_low_bit_block = current_grey_block & 15
+        current_low_bits_svd = metrics.get_SVD_s(current_low_bit_block)
+
+        current_min = current_low_bits_svd.min()
+        current_max = current_low_bits_svd.max()
+
+        if current_min < low_bits_min_val:
+            low_bits_min_val = current_min
+
+        if current_max > low_bits_max_val:
+            low_bits_max_val = current_max
+
+    low_bits_svd_values_norm_together.append(image_processing.normalize_arr_with_range(low_bits_svd, low_bits_min_val, low_bits_max_val))
+
+    # Other MSCN
+    img_grey = np.array(color.rgb2gray(np.asarray(block_used))*255, 'uint8')
+
+
+    img_mscn_in_grey = np.array(image_processing.normalize_2D_arr(image_processing.calculate_mscn_coefficients(img_grey, 7))*255, 'uint8')
+    svd_s_values = metrics.get_SVD_s(img_mscn_in_grey)
+    #print(svd_s_values[0:10])
+
+    img_mscn_pil = Image.fromarray(img_mscn_in_grey.astype('uint8'), 'L')
+    #img_mscn_pil.show()
+
+
+
+
+#path_noisy = '/home/jbuisine/Documents/Thesis/Development/NoiseDetection_In_SynthesisImages/fichiersSVD_light/Appart1opt02/appartAopt_00020.png'
+#path_threshold = '/home/jbuisine/Documents/Thesis/Development/NoiseDetection_In_SynthesisImages/fichiersSVD_light/Appart1opt02/appartAopt_00300.png'
+#path_ref = '/home/jbuisine/Documents/Thesis/Development/NoiseDetection_In_SynthesisImages/fichiersSVD_light/Appart1opt02/appartAopt_00900.png'
+
+path_noisy = '/home/jbuisine/Documents/Thesis/Development/NoiseDetection_In_SynthesisImages/fichiersSVD_light/Cuisine01/cuisine01_00050.png'
+path_threshold = '/home/jbuisine/Documents/Thesis/Development/NoiseDetection_In_SynthesisImages/fichiersSVD_light/Cuisine01/cuisine01_00400.png'
+path_ref = '/home/jbuisine/Documents/Thesis/Development/NoiseDetection_In_SynthesisImages/fichiersSVD_light/Cuisine01/cuisine01_01200.png'
+
+
+path_list = [path_noisy, path_threshold, path_ref]
+
+for p in path_list:
+    open_and_display(p)
+
+import matplotlib.pyplot as plt
+
+# SVD
+fig, (ax1, ax2, ax3) = plt.subplots(3, 1)
+# make a little extra space between the subplots
+fig.subplots_adjust(hspace=0.5)
+
+ax1.plot(lab_svd_values[0], label='Noisy')
+ax1.plot(lab_svd_values[1], label='Threshold')
+ax1.plot(lab_svd_values[2], label='Reference')
+ax1.set_ylabel('LAB SVD comparisons')
+ax1.legend(bbox_to_anchor=(0.7, 1), loc=2, borderaxespad=0.2)
+
+ax2.plot(mscn_svd_values[0], label='Noisy')
+ax2.plot(mscn_svd_values[1], label='Threshold')
+ax2.plot(mscn_svd_values[2], label='Reference')
+ax2.set_ylabel('MSCN SVD comparisons')
+ax2.legend(bbox_to_anchor=(0.7, 1), loc=2, borderaxespad=0.2)
+
+ax3.plot(low_bits_svd_values[0], label='Noisy')
+ax3.plot(low_bits_svd_values[1], label='Threshold')
+ax3.plot(low_bits_svd_values[2], label='Reference')
+ax3.set_ylabel('Low bits SVD comparisons')
+ax3.legend(bbox_to_anchor=(0.7, 1), loc=2, borderaxespad=0.2)
+
+plt.show()
+
+# SVDN
+
+fig, (ax1, ax2, ax3) = plt.subplots(3, 1)
+# make a little extra space between the subplots
+fig.subplots_adjust(hspace=0.5)
+
+ax1.plot(lab_svd_values_norm[0], label='Noisy')
+ax1.plot(lab_svd_values_norm[1], label='Threshold')
+ax1.plot(lab_svd_values_norm[2], label='Reference')
+ax1.set_ylabel('LAB SVDN comparisons')
+ax1.legend(bbox_to_anchor=(0.7, 1), loc=2, borderaxespad=0.2)
+
+ax2.plot(mscn_svd_values_norm[0], label='Noisy')
+ax2.plot(mscn_svd_values_norm[1], label='Threshold')
+ax2.plot(mscn_svd_values_norm[2], label='Reference')
+ax2.set_ylabel('MSCN SVDN comparisons')
+ax2.legend(bbox_to_anchor=(0.7, 1), loc=2, borderaxespad=0.2)
+
+ax3.plot(low_bits_svd_values_norm[0], label='Noisy')
+ax3.plot(low_bits_svd_values_norm[1], label='Threshold')
+ax3.plot(low_bits_svd_values_norm[2], label='Reference')
+ax3.set_ylabel('Low bits SVD comparisons')
+ax3.legend(bbox_to_anchor=(0.7, 1), loc=2, borderaxespad=0.2)
+
+plt.show()
+
+# SVDNE
+fig, (ax1, ax2, ax3) = plt.subplots(3, 1)
+# make a little extra space between the subplots
+fig.subplots_adjust(hspace=0.5)
+
+ax1.plot(lab_svd_values_norm_together[0], label='Noisy')
+ax1.plot(lab_svd_values_norm_together[1], label='Threshold')
+ax1.plot(lab_svd_values_norm_together[2], label='Reference')
+ax1.set_ylabel('LAB SVDNE comparisons')
+ax1.legend(bbox_to_anchor=(0.7, 1), loc=2, borderaxespad=0.2)
+
+ax2.plot(mscn_svd_values_norm_together[0], label='Noisy')
+ax2.plot(mscn_svd_values_norm_together[1], label='Threshold')
+ax2.plot(mscn_svd_values_norm_together[2], label='Reference')
+ax2.set_ylabel('MSCN SVDNE comparisons')
+ax2.legend(bbox_to_anchor=(0.7, 1), loc=2, borderaxespad=0.2)
+
+ax3.plot(low_bits_svd_values_norm_together[0], label='Noisy')
+ax3.plot(low_bits_svd_values_norm_together[1], label='Threshold')
+ax3.plot(low_bits_svd_values_norm_together[2], label='Reference')
+ax3.set_ylabel('Low bits SVD comparisons')
+ax3.legend(bbox_to_anchor=(0.7, 1), loc=2, borderaxespad=0.2)
+plt.show()
+
+
+#print(mscn_svd_values[0][0:3])
+#print(mscn_svd_values[1][0:3])
+#print(mscn_svd_values[2][0:3])
+