Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
luigi311 committed Jan 3, 2024
1 parent 4d69f52 commit 9bc3f5f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions exif_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def main(args):
else:
raise Exception("No output or image_destination specified")


if __name__ == "__main__":
try:
total_tic = time()
Expand Down
12 changes: 9 additions & 3 deletions images/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def process_raw(dng_file, half_size=False, auto_white_balance=False):

return image


def process_image(image_path, half_size=False, auto_white_balance=False):
if image_path.endswith("dng"):
image = process_raw(image_path, half_size, auto_white_balance)
Expand Down Expand Up @@ -66,7 +67,7 @@ def resize_images(images):
print(f"Skipping image due to aspect ratio: {image.shape}")
else:
resized_images.append(image)

return resized_images


Expand All @@ -91,9 +92,14 @@ def loadImages(path, threads=None, half_size=False, auto_white_balance=False):
# Instead of appending, concatenate the result images to numpy_array
with ProcessPoolExecutor(max_workers=workers) as executor:
if file_list:
for result_image in executor.map(process_image, file_list, [half_size] * len(file_list), [auto_white_balance] * len(file_list)):
for result_image in executor.map(
process_image,
file_list,
[half_size] * len(file_list),
[auto_white_balance] * len(file_list),
):
images.append(result_image)

images = resize_images(images)

return np.array(images)
Expand Down
2 changes: 1 addition & 1 deletion utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def files(path: str) -> list:
process_file_list.append(os.path.join(path, file))
# Allow other unncompressed formats to be processed
elif file.endswith("png"):
# exclude all that include main in the name to
# exclude all that include main in the name to
# avoid processing processed images
if "main" not in file:
process_file_list.append(os.path.join(path, file))
Expand Down

0 comments on commit 9bc3f5f

Please sign in to comment.