Commit 0697219e authored by Nathaniel Callens's avatar Nathaniel Callens

Latest experimentations with tiff images

parent 9187e090
...@@ -42,30 +42,48 @@ def image_extractor(scenes): ...@@ -42,30 +42,48 @@ def image_extractor(scenes):
if __name__ == '__main__': if __name__ == '__main__':
"""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"""
tiff0 = []
tiff1 = []
tiff2 = []
tiff3 = []
files = os.listdir("images")
scenes = []
for file in files:
scene = os.path.join("images", file)
sc = os.listdir(scene)
for s in sc:
if s[-6] == '0':
tiff0.append(os.path.join(scene, s))
elif s[-6] == '1':
tiff1.append(os.path.join(scene, s))
elif s[-6] == '2':
tiff2.append(os.path.join(scene, s))
elif s[-6] == '3':
tiff3.append(os.path.join(scene, s))
image = Image.open("practice_tiff.tiff") diff = []
image2 = Image.open("practice2.tiff") for ii in range(len(tiff1)):
imarray2 = np.array(image2) image = Image.open(tiff1[ii])
imarray = np.array(image) image = np.array(image)[1:,:]
work = imarray2[:,:,0] ar1, ar2 = image.shape
ind1, ind2 = np.random.randint(0,434), np.random.randint(0,650)
ind1, ind2 = np.random.randint(0,ar1), np.random.randint(0,ar2)
surrounding = [] surrounding = []
for i,j in product(np.arange(-1,2), repeat=2): for i,j in product(np.arange(-1,2), repeat=2):
if i == 0 and j == 0: if i == 0 and j == 0:
continue continue
else: else:
surrounding.append(work[ind1+i, ind1+j]) surrounding.append(image[ind1+i, ind1+j])
diff = []
diff.append(np.max(surrounding)-np.min(surrounding)) diff.append(np.max(surrounding)-np.min(surrounding))
print(surrounding)
print(diff) 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() """scene_names = file_extractor("images")
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)
......
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