Commit 2838647d authored by Kelly Chang's avatar Kelly Chang
parents 33e09db3 789098e3
...@@ -41,31 +41,37 @@ def image_extractor(scenes): ...@@ -41,31 +41,37 @@ def image_extractor(scenes):
images.append(os.path.join(folder, im)) 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 return images #returns a list of file paths to .tiff files in the specified directory given in file_extractor
def im_distribution(images): def im_distribution(images, num):
tiff0 = [] """
tiff1 = [] Function that extracts tiff files from specific cameras and returns a list of all
tiff2 = [] the tiff files corresponding to that camera. i.e. all pictures labeled "_7.tiff" or otherwise
tiff3 = [] specified camera numbers.
files = os.listdir("images") Parameters:
scenes = [] images (list): list of all tiff files, regardless of classification. This is NOT a list of directories but
for file in files: of specific tiff files that can be opened right away. This is the list that we iterate through and
scene = os.path.join("images", file) divide.
sc = os.listdir(scene)
for s in sc: num (str): a string designation for the camera number that we want to extract i.e. "14" for double digits
if s[-6] == '0': of "_1" for single digits.
tiff0.append(os.path.join(scene, s))
elif s[-6] == '1': Returns:
tiff1.append(os.path.join(scene, s)) tiff (list): A list of tiff files that have the specified designation from num. They are the files extracted
elif s[-6] == '2': from the 'images' list that correspond to the given num.
tiff2.append(os.path.join(scene, s)) """
elif s[-6] == '3': tiff = []
tiff3.append(os.path.join(scene, s)) for im in images:
if im[-7:-6] == num:
cameras = [tiff0, tiff1, tiff2, tiff3] tiff.append(im)
im = Image.open(tiff0[0]) return tiff
im = np.array(im)[1:,:]
print(im)
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 jj = 0
fig, axs = plt.subplots(nrows=2, ncols=2, figsize=(15,12)) fig, axs = plt.subplots(nrows=2, ncols=2, figsize=(15,12))
for cam, ax in zip(cameras, axs.ravel()): 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