DBoW2 Documentation

repository·master·Indexed 21 days ago

https://github.com/dorian3d/dbow2

A high-performance C++ library for converting images into bag-of-words representations using hierarchical trees. DBoW2 is descriptor-agnostic via C++ templates, integrates with OpenCV for storage and data handling, and provides built-in support for ORB and BRIEF descriptors.

Tokens
695
Snippets
1
Records
5
Agent score
26%

What's inside DBoW2

  1. What is DBoW2?

    master

    DBoW2 is a C++ library for indexing and converting images into a bag-of-word representation. It uses a hierarchical tree to approximate nearest neighbours in the image feature space to create a visual vocabulary. It also provides an image database with inverted and direct files for fast image queries and feature comparisons.

    Key features include:

    • Templated Design: Works with any descriptor type.
    • Built-in Support: Includes classes for ORB and BRIEF descriptors.
    • OpenCV Integration: Uses OpenCV's storage system for saving/loading vocabularies and databases (supports YAML and .gz compression).
    • Fast Feature Comparison: Includes a direct file in the image database for rapid comparisons (used by DLoopDetector).
  2. How to use TemplatedVocabulary and TemplatedDatabase

    master

    DBoW2's core functionality is implemented through two main templated classes. To use them, you must provide two template parameters:

    1. TDescriptor: The data type of a single descriptor vector.
    2. F: A class implementing descriptor manipulation functions (derived from FClass).

    Descriptor Type Mapping

    • ORB: TDescriptor is cv::Mat (type CV_8UC1, a single row of 32 8-bit values).
    • BRIEF: TDescriptor is boost::dynamic_bitset<>.

    Predefined Classes

    For common use cases, DBoW2 provides non-templated wrappers:

    • ORB: Use OrbVocabulary and OrbDatabase (using FORB as the descriptor handler).
    • BRIEF: Use BriefVocabulary and BriefDatabase (using FBrief as the descriptor handler).
    template<class TDescriptor, class F>
    class TemplatedVocabulary
    {
      ...
    };
    
    template<class TDescriptor, class F>
    class TemplatedDatabase
    {
      ...
    };
  3. Weighting and scoring in DBoW2

    master
    DBoW2 implements standard weighting and scoring mechanisms. Note that DBoW2 automatically scales all scores to the range [0..1], so the scaling flag used in previous versions of the library is no longer required.
  4. Requirements for using DBoW2

    master

    To use DBoW2, you need the following dependencies:

    • OpenCV: Required for storage and descriptor handling.
    • Boost::dynamic_bitset: Required specifically if you intend to use the BRIEF descriptor version.
  5. Save and load vocabularies and databases

    master

    Vocabularies and databases can be persisted to disk using the save and load member functions.

    Key behaviors:

    • Self-contained Databases: When a database is saved, the associated vocabulary is embedded within the file, making the database file independent.
    • OpenCV Compatibility: You can add vocabulary or database data to any file opened with a cv::FileStorage object.
    • Compression: You can use any file extension. If you use the .gz extension, the file will be automatically compressed using OpenCV's built-in gunzip support.