Adding the crop code made for videos to images (#1598)

* added equirect support

* added cropping for planar image input

* random comment

* bug fix and running command

* added crop-factor to docstrings
This commit is contained in:
Rohan Mathur authored and GitHub committed 2023-03-14 12:04:28 -07:00
1 parent de6af6c4e5
commit 2838cfc8a5
2 files changed
+30 -6

No files matched your search

+4 -2
View File
@@ -91,6 +91,8 @@ class ProcessImages:
"""Number of samples per image to take from each equirectangular image.
Used only when camera-type is equirectangular.
"""
crop_factor: Tuple[float, float, float, float] = (0.0, 0.0, 0.0, 0.0)
"""Portion of the image to crop. All values should be in [0,1]. (top, bottom, left, right)"""
gpu: bool = True
"""If True, use GPU."""
use_sfm_depth: bool = False
@@ -129,7 +131,7 @@ class ProcessImages:
pers_size = equirect_utils.compute_resolution_from_equirect(self.data, self.images_per_equirect)
CONSOLE.log(f"Generating {self.images_per_equirect} {pers_size} sized images per equirectangular image")
self.data = equirect_utils.generate_planar_projections_from_equirectangular(
self.data, pers_size, self.images_per_equirect
self.data, pers_size, self.images_per_equirect, crop_factor=self.crop_factor
)
summary_log = []
@@ -138,7 +140,7 @@ class ProcessImages:
if not self.skip_image_processing:
# Copy images to output directory
image_rename_map_paths = process_data_utils.copy_images(
self.data, image_dir=image_dir, verbose=self.verbose
self.data, image_dir=image_dir, crop_factor=self.crop_factor, verbose=self.verbose
)
image_rename_map = dict((a.name, b.name) for a, b in image_rename_map_paths.items())
num_frames = len(image_rename_map)