colmap / pycolmap

Python bindings for COLMAP
BSD 3-Clause "New" or "Revised" License
899 stars 129 forks source link

How to enable loop_detection in COLMAP mapping? #202

Closed Arthurshen926 closed 8 months ago

Arthurshen926 commented 10 months ago

Hi, thanks for your efforts of integrating the COLMAP for Python API ! I wondered how to enable loop_detection in pycolmap. I first found loop_detection flag in colmap::SequentialMatchingOptions with not seeing relevant API in pycolmap, could you please how to do that? Or is this part still under developing? I use triangulate_points() in https://github.com/colmap/pycolmap/blob/de3ce4c70678818950193a39425aa35cb1f10139/pipeline/sfm.cc#L28C1-L35C36 where there is a mapper_options leading to colmap::RunPointTriangulatorImpl->IncrementalMapperOptions->IncrementalMapper::Options

I also found a clue in your repository, how to modify the options? https://github.com/colmap/pycolmap/blob/de3ce4c70678818950193a39425aa35cb1f10139/pipeline/match_features.cc#L133C2-L195C48

sarlinpe commented 8 months ago

PyCOLMAP indeed supports sequential matching with loop closure:

help(pycolmap.SequentialMatchingOptions)  # check the options and their defaults
opts = pycolmap.SequentialMatchingOptions(...)
pycolmap.match_exhaustive(database_path, matching_options=opts)

This should be used as replacement of exhaustive matching, before the reconstruction process.