|
RTAB-Map 0.23.10
Real-Time Appearance-Based Mapping
|
Recursive Bayesian filter for loop-closure hypothesis estimation in RTAB-Map. More...
#include <BayesFilter.h>
Public Member Functions | |
| BayesFilter (const ParametersMap ¶meters=ParametersMap()) | |
| Constructs a Bayes filter with default or custom parameters. | |
| virtual void | parseParameters (const ParametersMap ¶meters) |
| Updates internal settings from the parameter map. | |
| const std::map< int, float > & | computePosterior (const Memory *memory, const std::map< int, float > &likelihood) |
| Runs one Bayes filter iteration (prediction + update). | |
| void | reset () |
| Clears posterior, prediction matrix and cached neighbor indices. | |
| void | setPredictionLC (const std::string &prediction) |
| Sets the loop-closure prediction model from a space-separated string. | |
| const std::map< int, float > & | getPosterior () const |
| Returns the current posterior probability map. | |
| float | getVirtualPlacePrior () const |
| Returns the virtual place prior threshold. | |
| const std::vector< double > & | getPredictionLC () const |
| Returns the loop-closure prediction model as a vector of values. | |
| std::string | getPredictionLCStr () const |
| Returns the loop-closure prediction model as a space-separated string. | |
| cv::Mat | generatePrediction (const Memory *memory, const std::vector< int > &ids) |
| Builds or updates the prediction (transition) matrix for the given signature ids. | |
| unsigned long | getMemoryUsed () const |
| Estimates memory usage of this object and its internal containers. | |
Recursive Bayesian filter for loop-closure hypothesis estimation in RTAB-Map.
This class implements the prediction and update steps of a Bayes filter used to estimate the posterior probability over candidate locations (signatures) in working memory. It is typically called by Rtabmap after likelihood values have been computed from visual word comparisons.
The filter operates in two steps on each iteration:
The prediction matrix is built from neighbor relationships in Memory, using a Gaussian-like model configured through Parameters::kBayesPredictionLC(). A virtual place (negative signature id, see Memory::kIdVirtual) represents the hypothesis that the current observation comes from a new location.
Related parameters (see Parameters):
Definition at line 71 of file BayesFilter.h.
| rtabmap::BayesFilter::BayesFilter | ( | const ParametersMap & | parameters = ParametersMap() | ) |
Constructs a Bayes filter with default or custom parameters.
| parameters | Optional parameter map (Bayes group keys). Defaults are used for missing keys. |
|
virtual |
Updates internal settings from the parameter map.
| parameters | Map containing Bayes group keys. |
| const std::map< int, float > & rtabmap::BayesFilter::computePosterior | ( | const Memory * | memory, |
| const std::map< int, float > & | likelihood | ||
| ) |
Runs one Bayes filter iteration (prediction + update).
Given a likelihood map over signature ids, computes and stores the normalized posterior. The prediction matrix is generated or updated from Memory using the ids present in likelihood.
| memory | Working memory instance (must not be null). |
| likelihood | Observation likelihood per signature id (must not be empty). |
| void rtabmap::BayesFilter::setPredictionLC | ( | const std::string & | prediction | ) |
Sets the loop-closure prediction model from a space-separated string.
Format: {Vp, Lc, l1, l2, l3, ...} where:
Each value must be in [0, 1]. At least two values are required. Invalid strings are rejected and the previous model is kept.
| prediction | Space-separated list of probabilities (same format as Parameters::kBayesPredictionLC()). |
|
inline |
Returns the current posterior probability map.
Definition at line 125 of file BayesFilter.h.
|
inline |
Returns the virtual place prior threshold.
Definition at line 131 of file BayesFilter.h.
| const std::vector< double > & rtabmap::BayesFilter::getPredictionLC | ( | ) | const |
Returns the loop-closure prediction model as a vector of values.
{Vp, Lc, l1, l2, l3, ...}. | std::string rtabmap::BayesFilter::getPredictionLCStr | ( | ) | const |
Returns the loop-closure prediction model as a space-separated string.
| cv::Mat rtabmap::BayesFilter::generatePrediction | ( | const Memory * | memory, |
| const std::vector< int > & | ids | ||
| ) |
Builds or updates the prediction (transition) matrix for the given signature ids.
Rows and columns correspond to ids. Neighbor links are queried from Memory to fill transition probabilities according to getPredictionLC(). When ids match the current posterior keys, the cached matrix may be returned without recomputation.
| memory | Working memory instance (must not be null). |
| ids | Ordered list of signature ids (often includes Memory::kIdVirtual as first element). |
| unsigned long rtabmap::BayesFilter::getMemoryUsed | ( | ) | const |
Estimates memory usage of this object and its internal containers.