diff --git a/pyproject.toml b/pyproject.toml index 6a11c7ae..9537969e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,9 +19,8 @@ dependencies = [ "einops", "huggingface_hub", "imageio", - "numpy<2", - "opencv-python", - "xformers", + "numpy>=2.0,<3", + "opencv-python>=4.8.0", "open3d", "fastapi", "uvicorn", @@ -38,13 +37,14 @@ dependencies = [ "uvicorn", "moviepy==1.0.3", "typer>=0.9.0", - "pycolmap", ] [project.optional-dependencies] app = ["gradio>=5", "pillow>=9.0"] # requires that python3>=3.10 gs = ["gsplat @ git+https://github.com/nerfstudio-project/gsplat.git@0b4dddf04cb687367602c01196913cde6a743d70"] -all = ["depth-anything-3[app,gs]"] +colmap = ["pycolmap"] +xformers = ["xformers"] +all = ["depth-anything-3[app,gs,colmap,xformers]"] [project.scripts] diff --git a/src/depth_anything_3/utils/export/__init__.py b/src/depth_anything_3/utils/export/__init__.py index e3e4c657..90908564 100644 --- a/src/depth_anything_3/utils/export/__init__.py +++ b/src/depth_anything_3/utils/export/__init__.py @@ -15,7 +15,6 @@ from depth_anything_3.specs import Prediction from depth_anything_3.utils.export.gs import export_to_gs_ply, export_to_gs_video -from .colmap import export_to_colmap from .depth_vis import export_to_depth_vis from .feat_vis import export_to_feat_vis from .glb import export_to_glb @@ -49,6 +48,12 @@ def export( elif export_format == "gs_video": export_to_gs_video(prediction, export_dir, **kwargs.get(export_format, {})) elif export_format == "colmap": + try: + from .colmap import export_to_colmap + except ImportError as e: + raise ImportError( + "pycolmap is not installed. Please install it using 'pip install pycolmap' to use the COLMAP export feature." + ) from e export_to_colmap(prediction, export_dir, **kwargs.get(export_format, {})) else: raise ValueError(f"Unsupported export format: {export_format}") diff --git a/src/depth_anything_3/utils/visualize.py b/src/depth_anything_3/utils/visualize.py index 8fd32bdd..5f4adde0 100644 --- a/src/depth_anything_3/utils/visualize.py +++ b/src/depth_anything_3/utils/visualize.py @@ -68,7 +68,7 @@ def visualize_depth( img_colored_np = cm(depth[None], bytes=False)[:, :, :, 0:3] # value from 0 to 1 if ret_type == np.uint8: img_colored_np = (img_colored_np[0] * 255.0).astype(np.uint8) - elif ret_type == np.float32 or ret_type == np.float64: + elif np.issubdtype(ret_type, np.floating): img_colored_np = img_colored_np[0] else: raise ValueError(f"Invalid return type: {ret_type}")