Fast downscaling for video and image processing (PR2168 plus images) (#2213)

* Merge video image extraction and downscaling

* Linting

* Fix extracting all frames, only apply vfr when thumnailing

* integrate downscale chains into image processing

* fast polycam upscale/downscale depth

* black

* black

* Update process_data_utils.py

Remove code change from other branch.

* use same suffix for downscale, don't force png

* black

---------

Co-authored-by: Sebastiaan Meijer <seb@stiaan.io>
This commit is contained in:
machenmusikandSebastiaan Meijer authored and GitHub committed 2023-07-13 18:54:19 -04:00
1 parent edbe319924
commit 91291bc52c
5 files changed
+129 -79

No files matched your search

+6 -11
View File
@@ -131,6 +131,7 @@ def process_images(
image_dir=image_dir,
crop_border_pixels=crop_border_pixels,
verbose=verbose,
num_downscales=num_downscales,
)
num_frames = len(copied_image_paths)
@@ -145,9 +146,6 @@ def process_images(
else:
summary_log.append(f"Started with {num_frames} images")
# Downscale images
summary_log.append(process_data_utils.downscale_images(image_dir, num_downscales, verbose=verbose))
# Save json
if num_frames == 0:
CONSOLE.print("[bold red]No images found, exiting")
@@ -190,7 +188,11 @@ def process_depth_maps(
# Copy depth images to output directory
copied_depth_maps_paths = process_data_utils.copy_and_upscale_polycam_depth_maps_list(
polycam_depth_maps_filenames, depth_dir=depth_dir, crop_border_pixels=crop_border_pixels, verbose=verbose
polycam_depth_maps_filenames,
depth_dir=depth_dir,
num_downscales=num_downscales,
crop_border_pixels=crop_border_pixels,
verbose=verbose,
)
num_processed_depth_maps = len(copied_depth_maps_paths)
@@ -211,11 +213,4 @@ def process_depth_maps(
else:
summary_log.append(f"Started with {num_processed_depth_maps} images")
# Downscale depth maps
summary_log.append(
process_data_utils.downscale_images(
depth_dir, num_downscales, folder_name="depths", nearest_neighbor=True, verbose=verbose
)
)
return summary_log, polycam_depth_maps_filenames