Commit 789098e3 authored by Nathaniel Callens's avatar Nathaniel Callens

functions added

parent 802e8010
......@@ -41,31 +41,37 @@ def image_extractor(scenes):
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
def im_distribution(images):
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))
cameras = [tiff0, tiff1, tiff2, tiff3]
im = Image.open(tiff0[0])
im = np.array(im)[1:,:]
print(im)
def im_distribution(images, num):
"""
Function that extracts tiff files from specific cameras and returns a list of all
the tiff files corresponding to that camera. i.e. all pictures labeled "_7.tiff" or otherwise
specified camera numbers.
Parameters:
images (list): list of all tiff files, regardless of classification. This is NOT a list of directories but
of specific tiff files that can be opened right away. This is the list that we iterate through and
divide.
num (str): a string designation for the camera number that we want to extract i.e. "14" for double digits
of "_1" for single digits.
Returns:
tiff (list): A list of tiff files that have the specified designation from num. They are the files extracted
from the 'images' list that correspond to the given num.
"""
tiff = []
for im in images:
if im[-7:-6] == num:
tiff.append(im)
return tiff
def plot_hist(tiff_list):
"""
This function is the leftovers from the first attempt to plot histograms.
As it stands it needs some work in order to function again. We will
fix this later. 1/25/22
"""
jj = 0
fig, axs = plt.subplots(nrows=2, ncols=2, figsize=(15,12))
for cam, ax in zip(cameras, axs.ravel()):
......
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