Skip to content

Commit

Permalink
Update example
Browse files Browse the repository at this point in the history
  • Loading branch information
sarlinpe committed Jan 15, 2024
1 parent 8758d5a commit 1dccad6
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import zipfile
from pathlib import Path

import enlighten

import pycolmap
from pycolmap import logging

Expand All @@ -28,13 +30,23 @@ def run():
if database_path.exists():
database_path.unlink()
pycolmap.extract_features(database_path, image_path)

pycolmap.match_exhaustive(database_path)
num_images = pycolmap.Database(database_path).num_images

if sfm_path.exists():
shutil.rmtree(sfm_path)
sfm_path.mkdir(exist_ok=True)
recs = pycolmap.incremental_mapping(database_path, image_path, sfm_path)

with enlighten.Manager() as manager:
with manager.counter(total=num_images, desc="Images registered:") as pbar:
pbar.update(0, force=True)
recs = pycolmap.incremental_mapping(
database_path,
image_path,
sfm_path,
initial_image_pair_callback=lambda: pbar.update(2),
next_image_callback=lambda: pbar.update(1),
)
for idx, rec in recs.items():
logging.info(f"#{idx} {rec.summary()}")

Expand Down

0 comments on commit 1dccad6

Please sign in to comment.