def get_image_list(self, verbal=False):
        if verbal:
            print()
            print("***   Get image list   ***")
            print("---------------------------------")
        filename = 'Indian_pines_corrected.mat'
        ImDict = io.loadmat(self.data_dir + filename)
        image_name = 'indian_pines_corrected'
        the_image = ImDict[image_name]
        image_size = np.shape(the_image)
        NRows = image_size[0]
        NCols = image_size[1]
        NBands = image_size[2]
        if verbal:
            print("Lokalizacja obrazu: \t", self.data_dir + filename)
            print("Nazwa obrazu:  \t\t\t", image_name)
            print("Rozmiar: \t\t\t\t", "wiersze: ", NRows, " kolumny: ", NCols,
                  " zakresy: ", NBands)
            print("Ilośc pikseli (ilość kolumn * ilość wierszy): ",
                  NRows * NCols)

        if verbal:
            print()
            print("***   Converting image to uint8   ***")
            print("---------------------------------")
            # converted_image = mo.numpy_to_uint8(the_image)
        the_image = mo.numpy_to_uint8(the_image)

        the_image_list = []
        for row in the_image:
            for element in row:
                the_image_list.append(element)
        print("List of points shape: ", np.shape(the_image_list))

        return the_image_list
Beispiel #2
0
    def get_image(self, verbal=False):
        if verbal:
            print()
            print("***   Get image   ***")
            print("---------------------------------")

        if not self.image_exists:
            filename = 'PaviaU.mat'
            ImDict = io.loadmat(self.data_dir + filename)
            image_name = 'paviaU'
            the_image = ImDict[image_name]
            image_size = np.shape(the_image)
            NRows = image_size[0]
            NCols = image_size[1]
            depth = image_size[2]
            print("Lokalizacja obrazu: \t", self.data_dir + filename)
            print("Nazwa obrazu:  \t\t\t", image_name)
            print("Rozmiar: \t\t\t\t", "wiersze: ", NRows, " kolumny: ", NCols,
                  " głębokość: ", depth)
            print("Ilośc pikseli (ilość kolumn * ilość wierszy): ",
                  NRows * NCols)

            print()
            print("***   Converting image to uint8   ***")
            print("---------------------------------")
            the_image = mo.numpy_to_uint8(the_image)

            self.image = the_image
            self.image_exists = True

        return self.image
    def get_image_list(self, verbal=False):
        if verbal:
            print()
            print("***   Get image list   ***")
            print("---------------------------------")

        if not self.image_list_exists:
            filename = 'jasperRidge2_R198.mat'
            ImDict = io.loadmat(self.data_dir + filename)
            image_name = 'Y'
            the_image_list = ImDict[image_name]
            the_image_list = the_image_list.transpose()
            the_image_list_turned = mo.turn_image_in_list(
                the_image_list, self.image_shape)
            image_size = np.shape(the_image_list_turned)
            NRows = image_size[0]
            NCols = image_size[1]
            print("Lokalizacja obrazu: \t", self.data_dir + filename)
            print("Nazwa obrazu:  \t\t\t", image_name)
            print("Rozmiar: \t\t\t\t", "wiersze: ", NRows, " kolumny: ", NCols)
            print("Ilośc pikseli (ilość kolumn * ilość wierszy): ",
                  NRows * NCols)

            print()
            print("***   Converting image to uint8   ***")
            print("---------------------------------")
            the_image_list = mo.numpy_to_uint8(the_image_list)

            self.image_list = the_image_list_turned
            self.image_list_exists = True

        return self.image_list