RTAB-Map 0.23.10
Real-Time Appearance-Based Mapping
Loading...
Searching...
No Matches
rtabmap::VisualWord Class Reference

Represents a visual word (feature descriptor) used in the bag-of-words (BoW) model. More...

#include <VisualWord.h>

Public Member Functions

 VisualWord (int id, const cv::Mat &descriptor, int signatureId=0)
 Constructor.
 
 ~VisualWord ()
 Destructor.
 
void addRef (int signatureId)
 Adds a reference to this word for the given signature ID.
 
int removeAllRef (int signatureId)
 Removes all references to this word for the given signature ID.
 
unsigned long getMemoryUsed () const
 Estimates the memory used by this visual word in bytes.
 
int getTotalReferences () const
 Returns the total number of references (across all signatures).
 
int id () const
 Returns the ID of this visual word.
 
const cv::Mat & getDescriptor () const
 Returns the feature descriptor of this word.
 
const std::map< int, int > & getReferences () const
 Returns the references of this word.
 
bool isSaved () const
 Checks if the word has been saved to the database.
 
void setSaved (bool saved)
 Sets the saved flag for the word.
 

Detailed Description

Represents a visual word (feature descriptor) used in the bag-of-words (BoW) model.

A VisualWord holds a unique identifier, its descriptor (usually a feature vector from an image), and a record of where (in which signatures/images) it was observed. This is a key component in loop closure detection and visual place recognition in RTAB-Map.

The word keeps track of references (signature IDs) where it appears, and how many times it was observed in each signature. It also tracks whether the word has been saved to a database.

Definition at line 49 of file VisualWord.h.

Constructor & Destructor Documentation

◆ VisualWord()

rtabmap::VisualWord::VisualWord ( int  id,
const cv::Mat &  descriptor,
int  signatureId = 0 
)

Constructor.

Parameters
idUnique ID of the visual word.
descriptorThe descriptor associated with the word (e.g., ORB, SIFT).
signatureIdOptional signature ID where the word is first observed.

Member Function Documentation

◆ addRef()

void rtabmap::VisualWord::addRef ( int  signatureId)

Adds a reference to this word for the given signature ID.

Parameters
signatureIdID of the signature in which this word is observed.

◆ removeAllRef()

int rtabmap::VisualWord::removeAllRef ( int  signatureId)

Removes all references to this word for the given signature ID.

Parameters
signatureIdID of the signature from which references will be removed.
Returns
Number of references removed.

◆ getMemoryUsed()

unsigned long rtabmap::VisualWord::getMemoryUsed ( ) const

Estimates the memory used by this visual word in bytes.

Returns
Size in bytes.

◆ getTotalReferences()

int rtabmap::VisualWord::getTotalReferences ( ) const
inline

Returns the total number of references (across all signatures).

Returns
Number of total references.

Definition at line 88 of file VisualWord.h.

◆ id()

int rtabmap::VisualWord::id ( ) const
inline

Returns the ID of this visual word.

Returns
Word ID.

Definition at line 94 of file VisualWord.h.

◆ getDescriptor()

const cv::Mat & rtabmap::VisualWord::getDescriptor ( ) const
inline

Returns the feature descriptor of this word.

Returns
The OpenCV matrix descriptor.

Definition at line 100 of file VisualWord.h.

◆ getReferences()

const std::map< int, int > & rtabmap::VisualWord::getReferences ( ) const
inline

Returns the references of this word.

Returns
A map of (signature ID, occurrence count).

Definition at line 106 of file VisualWord.h.

◆ isSaved()

bool rtabmap::VisualWord::isSaved ( ) const
inline

Checks if the word has been saved to the database.

Returns
True if saved, false otherwise.

Definition at line 112 of file VisualWord.h.

◆ setSaved()

void rtabmap::VisualWord::setSaved ( bool  saved)
inline

Sets the saved flag for the word.

Parameters
savedTrue if the word has been saved to the database.

Definition at line 118 of file VisualWord.h.


The documentation for this class was generated from the following file: