BayesFilter.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7  * Redistributions of source code must retain the above copyright
8  notice, this list of conditions and the following disclaimer.
9  * Redistributions in binary form must reproduce the above copyright
10  notice, this list of conditions and the following disclaimer in the
11  documentation and/or other materials provided with the distribution.
12  * Neither the name of the Universite de Sherbrooke nor the
13  names of its contributors may be used to endorse or promote products
14  derived from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
28 #ifndef BAYESFILTER_H_
29 #define BAYESFILTER_H_
30 
31 #include "rtabmap/core/rtabmap_core_export.h" // DLL export/import defines
32 
33 #include <opencv2/core/core.hpp>
34 #include <list>
35 #include <set>
38 
39 namespace rtabmap {
40 
41 class Memory;
42 class Signature;
43 
44 class RTABMAP_CORE_EXPORT BayesFilter
45 {
46 public:
47  BayesFilter(const ParametersMap & parameters = ParametersMap());
48  virtual ~BayesFilter();
49  virtual void parseParameters(const ParametersMap & parameters);
50  const std::map<int, float> & computePosterior(const Memory * memory, const std::map<int, float> & likelihood);
51  void reset();
52 
53  //setters
54  void setPredictionLC(const std::string & prediction);
55 
56  //getters
57  const std::map<int, float> & getPosterior() const {return _posterior;}
58  float getVirtualPlacePrior() const {return _virtualPlacePrior;}
59  const std::vector<double> & getPredictionLC() const; // {Vp, Lc, l1, l2, l3, l4...}
60  std::string getPredictionLCStr() const; // for convenience {Vp, Lc, l1, l2, l3, l4...}
61 
62  cv::Mat generatePrediction(const Memory * memory, const std::vector<int> & ids);
63 
64  unsigned long getMemoryUsed() const;
65 
66 private:
67  cv::Mat updatePrediction(const cv::Mat & oldPrediction,
68  const Memory * memory,
69  const std::vector<int> & oldIds,
70  const std::vector<int> & newIds);
71  void updatePosterior(const Memory * memory, const std::vector<int> & likelihoodIds);
72  void normalize(cv::Mat & prediction, unsigned int index, float addedProbabilitiesSum, bool virtualPlaceUsed) const;
73 
74 private:
75  std::map<int, float> _posterior;
76  cv::Mat _prediction;
78  std::vector<double> _predictionLC; // {Vp, Lc, l1, l2, l3, l4...}
82  std::map<int, std::map<int, int> > _neighborsIndex;
83 };
84 
85 } // namespace rtabmap
86 
87 #endif /* BAYESFILTER_H_ */
rtabmap::BayesFilter::_prediction
cv::Mat _prediction
Definition: BayesFilter.h:76
rtabmap::BayesFilter::getVirtualPlacePrior
float getVirtualPlacePrior() const
Definition: BayesFilter.h:58
rtabmap::BayesFilter::_neighborsIndex
std::map< int, std::map< int, int > > _neighborsIndex
Definition: BayesFilter.h:82
glm::normalize
GLM_FUNC_DECL genType normalize(genType const &x)
rtabmap::ParametersMap
std::map< std::string, std::string > ParametersMap
Definition: Parameters.h:43
Parameters.h
rtabmap::BayesFilter::_virtualPlacePrior
float _virtualPlacePrior
Definition: BayesFilter.h:77
rtabmap::BayesFilter::getPosterior
const std::map< int, float > & getPosterior() const
Definition: BayesFilter.h:57
rtabmap::BayesFilter::_totalPredictionLCValues
float _totalPredictionLCValues
Definition: BayesFilter.h:80
rtabmap::BayesFilter::_predictionLC
std::vector< double > _predictionLC
Definition: BayesFilter.h:78
rtabmap::BayesFilter::_posterior
std::map< int, float > _posterior
Definition: BayesFilter.h:75
rtabmap::BayesFilter::_fullPredictionUpdate
bool _fullPredictionUpdate
Definition: BayesFilter.h:79
UEventsHandler.h
rtabmap::Memory
Definition: Memory.h:64
rtabmap::BayesFilter::_predictionEpsilon
float _predictionEpsilon
Definition: BayesFilter.h:81
rtabmap
Definition: CameraARCore.cpp:35
rtabmap::BayesFilter
Definition: BayesFilter.h:44


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:06