4
0
mirror of https://github.com/nerfstudio-project/nerfstudio.git synced 2026-11-11 18:44:21 +08:00

Added support for .tif and .tiff files in equirect utils (#2613)

* added tiff to equirect utils

* added tif files
This commit is contained in:
Rohan Mathur 2023-12-14 17:22:20 -08:00 committed by GitHub
parent 622e26b511
commit 88873ef3ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -304,7 +304,7 @@ def generate_planar_projections_from_equirectangular(
with progress:
for i in progress.track(os.listdir(frame_dir), description="", total=num_ims):
if i.lower().endswith((".jpg", ".png", ".jpeg")):
if i.lower().endswith((".jpg", ".png", ".jpeg", ".tiff", ".tif")):
im = np.array(cv2.imread(os.path.join(frame_dir, i)))
im = torch.tensor(im, dtype=torch.float32, device=device)
im = torch.permute(im, (2, 0, 1)).unsqueeze(0) / 255.0
@ -331,7 +331,7 @@ def compute_resolution_from_equirect(image_dir: Path, num_images: int) -> Tuple[
"""
for i in os.listdir(image_dir):
if i.lower().endswith((".jpg", ".png", ".jpeg")):
if i.lower().endswith((".jpg", ".png", ".jpeg", ".tiff", ".tif")):
im = np.array(cv2.imread(os.path.join(image_dir, i)))
res_squared = (im.shape[0] * im.shape[1]) / num_images
return (int(np.sqrt(res_squared)), int(np.sqrt(res_squared)))