visloc-vision 0.5.0

Feature, matching, PnP, RANSAC, and pose-refinement building blocks for visloc-rs.
Documentation
//! Vocab-tree-style hierarchical retrieval — M3 in `docs/colmap_port_plan.md`
//! ("Vocab-tree-style retrieval (hierarchical + inverted file)"): a second,
//! opt-in pair-generation source for unordered-collection SfM, alongside the
//! existing flat-VLAD top-K path (`place_recognition::retrieve_mutual`, used
//! by `examples/unordered_sfm_demo.rs`'s `candidate_pairs`).
//!
//! Ported from `src/colmap/retrieval/*` and
//! `src/colmap/controllers/pairing.{h,cc}` (BSD-3-Clause, ETH Zurich / UNC
//! Chapel Hill, `github.com/colmap/colmap`, `main`, fetched 2026-07-17 —
//! per-feature citations live in each submodule's own doc comment):
//!
//! - [`hkm`] — the leaf-word quantizer: a genuine recursive hierarchical
//!   k-means (branching factor + depth), reusing this crate's existing
//!   deterministic k-means++ (`place_recognition::Vocabulary::build`) at
//!   every node. See its module doc for the honest, cited divergence from
//!   what COLMAP's `main` branch actually runs today (a flat faiss
//!   k-means + approximate-NN index, since May 2025 — this repo may not add
//!   a new ANN-index dependency, and targets far smaller corpora).
//! - [`index`] — TF-IDF + Hamming-embedding inverted-file scoring
//!   (`InvertedFile`/`InvertedIndex`), ported faithfully including
//!   burstiness normalization — COLMAP's scoring genuinely depends on
//!   binary Hamming signatures (verified by reading `inverted_file.h`
//!   directly, not assumed), so this is not an optional add-on skipped for
//!   convenience.
//! - [`pair_generator`] — `VocabTreePairGenerator`-equivalent: per-image
//!   top-N retrieval turned into a deduplicated, symmetric candidate-pair
//!   list, feeding the same downstream verification
//!   (`two_view::colmap_verification`) as the VLAD path.
//!
//! **Why a separate top-level module, not folded into [`super::place_recognition`]:**
//! COLMAP itself keeps `src/colmap/retrieval/` (this module's ancestor) and
//! VLAD-style aggregation entirely separate — COLMAP has no VLAD equivalent
//! at all; `place_recognition` is this repo's own addition. Mirroring
//! COLMAP's own module boundary here keeps each retrieval strategy's
//! ported-vs-original provenance unambiguous.
//!
//! **Descriptor-dimension note** (the milestone's own "SuperPoint is
//! 256-dim float, COLMAP's tree is built for 128-dim SIFT `uint8` — handle
//! the difference" ask): nothing in this port is hard-coded to 128 or to an
//! integer descriptor type. [`hkm::HierarchicalVocabulary::build`] and
//! [`index::VocabTree::build`] both take `&[f32]` of whatever
//! dimensionality the caller's descriptors have (SuperPoint's 256, or any
//! other), and the Hamming-embedding dimension
//! ([`index::VocabTreeOptions::embedding_dim`]) is an independent
//! configuration knob in COLMAP's own design (`kEmbeddingDim` is a separate
//! template parameter from `kDescDim`) — kept at COLMAP's literal default
//! (64) here rather than re-derived from 256, since COLMAP's own choice of
//! 64 was never a fixed fraction of 128 to begin with.

pub mod hkm;
pub mod index;
pub mod pair_generator;

pub use hkm::{HierarchicalVocabulary, HkmBuildOptions};
pub use index::{ImageScore, QueryWorkStats, VocabTree, VocabTreeOptions};
pub use pair_generator::{generate_pairs, VocabTreePairGeneratorOptions};