Loading compress_start.py +27 −5 Original line number Original line Diff line number Diff line Loading @@ -12,7 +12,7 @@ images and extract important statistics from them. import numpy as np import numpy as np from matplotlib import pyplot as plt from matplotlib import pyplot as plt from itertools import product import os import os import sys import sys from PIL import Image from PIL import Image Loading Loading @@ -41,7 +41,31 @@ def image_extractor(scenes): return images #returns a list of file paths to .tiff files in the specified directory given in file_extractor return images #returns a list of file paths to .tiff files in the specified directory given in file_extractor if __name__ == '__main__': if __name__ == '__main__': scene_names = file_extractor() image = Image.open("practice_tiff.tiff") image2 = Image.open("practice2.tiff") imarray2 = np.array(image2) imarray = np.array(image) work = imarray2[:,:,0] ind1, ind2 = np.random.randint(0,434), np.random.randint(0,650) surrounding = [] for i,j in product(np.arange(-1,2), repeat=2): if i == 0 and j == 0: continue else: surrounding.append(work[ind1+i, ind1+j]) diff = [] diff.append(np.max(surrounding)-np.min(surrounding)) print(surrounding) print(diff) """For boundary cases: Start by grabbing the shape of the images and saving those as variables. Then, if statements for if row == 0 or row == maximum and if col == 0 or col == maximum. Then grab corresponding open pixels. Then proceed to do an and statement that handles the corners""" """scene_names = file_extractor() images = image_extractor(scene_names) images = image_extractor(scene_names) im = Image.open(images[0]) im = Image.open(images[0]) imarray = np.array(im) imarray = np.array(im) Loading @@ -50,8 +74,6 @@ if __name__ == '__main__': image_array = [] image_array = [] for r in randos: for r in randos: image_array.append(np.array(Image.open(images[r]))) image_array.append(np.array(Image.open(images[r]))) indices = [val[i][j] for val in image_array] indices = [val[i][j] for val in image_array]""" No newline at end of file practice2.tiff 0 → 100644 +1.08 MiB Loading image diff... practice_tiff.tiff 0 → 100644 +4.99 MiB Loading image diff... Loading
compress_start.py +27 −5 Original line number Original line Diff line number Diff line Loading @@ -12,7 +12,7 @@ images and extract important statistics from them. import numpy as np import numpy as np from matplotlib import pyplot as plt from matplotlib import pyplot as plt from itertools import product import os import os import sys import sys from PIL import Image from PIL import Image Loading Loading @@ -41,7 +41,31 @@ def image_extractor(scenes): return images #returns a list of file paths to .tiff files in the specified directory given in file_extractor return images #returns a list of file paths to .tiff files in the specified directory given in file_extractor if __name__ == '__main__': if __name__ == '__main__': scene_names = file_extractor() image = Image.open("practice_tiff.tiff") image2 = Image.open("practice2.tiff") imarray2 = np.array(image2) imarray = np.array(image) work = imarray2[:,:,0] ind1, ind2 = np.random.randint(0,434), np.random.randint(0,650) surrounding = [] for i,j in product(np.arange(-1,2), repeat=2): if i == 0 and j == 0: continue else: surrounding.append(work[ind1+i, ind1+j]) diff = [] diff.append(np.max(surrounding)-np.min(surrounding)) print(surrounding) print(diff) """For boundary cases: Start by grabbing the shape of the images and saving those as variables. Then, if statements for if row == 0 or row == maximum and if col == 0 or col == maximum. Then grab corresponding open pixels. Then proceed to do an and statement that handles the corners""" """scene_names = file_extractor() images = image_extractor(scene_names) images = image_extractor(scene_names) im = Image.open(images[0]) im = Image.open(images[0]) imarray = np.array(im) imarray = np.array(im) Loading @@ -50,8 +74,6 @@ if __name__ == '__main__': image_array = [] image_array = [] for r in randos: for r in randos: image_array.append(np.array(Image.open(images[r]))) image_array.append(np.array(Image.open(images[r]))) indices = [val[i][j] for val in image_array] indices = [val[i][j] for val in image_array]""" No newline at end of file