Commit 9187e090 authored by Nathaniel Callens's avatar Nathaniel Callens

updated .py file

parent dae4680c
...@@ -12,7 +12,7 @@ images and extract important statistics from them. ...@@ -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
...@@ -41,7 +41,31 @@ def image_extractor(scenes): ...@@ -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)
...@@ -50,8 +74,6 @@ if __name__ == '__main__': ...@@ -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
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment