Commit 204424b1 authored by Nathaniel Callens's avatar Nathaniel Callens

initial files

parent 5b604f32
__pycache__
/.project
/.pydevproject
attic
*.log
\ No newline at end of file
'''
Created on Jan 11, 2022
@author: nathanielc
python file located in the Image Compression project
folder under nathanielc user. This python file is for
exploring possible image compression techniques and is by
no means a final product. Goal is to learn how to download
images and extract important statistics from them.
'''
import numpy as np
from matplotlib import pyplot as plt
import os
import sys
from PIL import Image
def file_extractor(dirname="/media/elphel/SSD3-4GB/lwir16-proc/captures/teasdale/scenes"):
files = os.listdir(dirname)
scenes = []
for file in files:
scenes.append(os.path.join(dirname, file))
return scenes
def image_extractor(scenes):
image_folder = []
for scene in scenes:
files = os.listdir(scene)
for file in files:
image_folder.append(os.path.join(scene, file))
images = []
for folder in image_folder:
ims = os.listdir(folder)
for im in ims:
if im[-4:] == ".jp4" or im[-7:] == "_6.tiff":
continue
else:
images.append(os.path.join(folder, im))
return images #returns a list of file paths to .tiff files in the specified directory given in file_extractor
if __name__ == '__main__':
scene_names = file_extractor()
images = image_extractor(scene_names)
im = Image.open(images[0])
imarray = np.array(im)
randos = np.random.randint(0,len(images), 10)
i, j = np.random.randint(0,imarray.shape[0]), np.random.randint(0,imarray.shape[1])
image_array = []
for r in randos:
image_array.append(np.array(Image.open(images[r])))
indices = [val[i][j] for val in image_array]
\ No newline at end of file
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