Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only import pycolmap in run_hloc #3146

Merged
merged 5 commits into from
May 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions nerfstudio/process_data/hloc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,6 @@
from nerfstudio.process_data.process_data_utils import CameraModel
from nerfstudio.utils.rich_utils import CONSOLE

try:
# TODO(1480) un-hide pycolmap import
import pycolmap
from hloc import ( # type: ignore
extract_features,
match_features,
pairs_from_exhaustive,
pairs_from_retrieval,
reconstruction,
)
except ImportError:
_HAS_HLOC = False

else:
_HAS_HLOC = True

try:
from pixsfm.refine_hloc import PixSfM # type: ignore
except ImportError:
_HAS_PIXSFM = False
else:
_HAS_PIXSFM = True


def run_hloc(
image_dir: Path,
Expand Down Expand Up @@ -88,6 +65,29 @@ def run_hloc(
refine_pixsfm: If True, refine the reconstruction using pixel-perfect-sfm.
use_single_camera_mode: If True, uses one camera for all frames. Otherwise uses one camera per frame.
"""

try:
# TODO(1480) un-hide pycolmap import
import pycolmap
from hloc import ( # type: ignore
extract_features,
match_features,
pairs_from_exhaustive,
pairs_from_retrieval,
reconstruction,
)
except ImportError:
_HAS_HLOC = False
else:
_HAS_HLOC = True

try:
from pixsfm.refine_hloc import PixSfM # type: ignore
except ImportError:
_HAS_PIXSFM = False
else:
_HAS_PIXSFM = True

if not _HAS_HLOC:
CONSOLE.print(
f"[bold red]Error: To use this set of parameters ({feature_type}/{matcher_type}/hloc), "
Expand Down
Loading