mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-16 04:43:52 +08:00
Fix bug when copying images when input_dir = output_dir (#2041)
* fixes bug input_dir == output_dir * reformat
This commit is contained in:
1 parent
43c399e71e
commit
d4b04376ab
1 file changed
+7
-2
@@ -195,7 +195,9 @@ def copy_images_list(
|
||||
|
||||
# Remove original directory only if we provide a proper image folder path
|
||||
if image_dir.is_dir() and len(image_paths):
|
||||
shutil.rmtree(image_dir, ignore_errors=True)
|
||||
# check that output directory is not the same as input directory
|
||||
if image_dir != image_paths[0].parent:
|
||||
shutil.rmtree(image_dir, ignore_errors=True)
|
||||
image_dir.mkdir(exist_ok=True, parents=True)
|
||||
|
||||
copied_image_paths = []
|
||||
@@ -205,7 +207,10 @@ def copy_images_list(
|
||||
if verbose:
|
||||
CONSOLE.log(f"Copying image {idx + 1} of {len(image_paths)}...")
|
||||
copied_image_path = image_dir / f"frame_{idx + 1:05d}{image_path.suffix}"
|
||||
shutil.copy(image_path, copied_image_path)
|
||||
try:
|
||||
shutil.copy(image_path, copied_image_path)
|
||||
except shutil.SameFileError:
|
||||
pass
|
||||
copied_image_paths.append(copied_image_path)
|
||||
|
||||
if crop_border_pixels is not None:
|
||||
|
||||
Reference in new issue
Block a user