GMMReducer.h
Go to the documentation of this file.
1 /*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package MemoryX::GaussianMixtureHelpers
17 * @author Alexey Kozlov <kozlov@kit.edu>
18 * @copyright 2013 Alexey Kozlov
19 * @license http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22 
23 #pragma once
24 
25 // boost
26 #include <memory>
27 
28 #include <string>
30 
32 #include "GMMDistance.h"
33 
34 namespace memoryx
35 {
36 
38  {
42  };
43 
44  using GMMCompPairDistance = std::pair<int, float>;
45  using GMMCompPairDistanceVector = std::vector<GMMCompPairDistance>;
46 
47  /**
48  * @class GMMReducer
49  * @ingroup CommonPlacesLearner
50  */
52  {
53  public:
54  /**
55  * Creates a new GMMReducer
56  */
58  {
59  }
60 
61  /**
62  *
63  *
64  */
65  virtual GaussianMixtureDistributionBasePtr reduceByComponentCount(const GaussianMixtureDistributionBasePtr& fullGMM, int countComp);
66 
67  virtual GaussianMixtureDistributionBasePtr reduceByMaxAABB(const GaussianMixtureDistributionBasePtr& fullGMM, float maxSideLength);
68 
69  virtual GaussianMixtureDistributionBasePtr reduceByMaxOrientedBBox(const GaussianMixtureDistributionBasePtr& fullGMM, float maxSideLength);
70 
71  virtual GaussianMixtureDistributionBasePtr reduceByMaxEqualSphere(const GaussianMixtureDistributionBasePtr& fullGMM, float maxSphereRadius);
72 
73  virtual GaussianMixtureDistributionBasePtr reduceByMaxDeviation(const GaussianMixtureDistributionBasePtr& fullGMM, float maxDeviation,
74  DeviationMeasure devMeasure);
75 
76  protected:
78 
79  virtual float getMergingCost(const GaussianMixtureDistributionBasePtr& gmm, int c1, int c2);
80 
81  virtual void fillMergingCostVector(const GaussianMixtureDistributionBasePtr& gmm, GMMCompPairDistanceVector& costVec);
82 
83  void mergeGMMComponents(const GaussianMixtureComponent& comp1, const GaussianMixtureComponent& comp2, GaussianMixtureComponent& mergedComp);
84 
85  void replaceComponentsWithMerged(GaussianMixtureDistributionPtr& gmm, int index1, int index2, const GaussianMixtureComponent& mergedComp);
86 
87  void mergeGMMComponents(GaussianMixtureDistributionPtr& gmm, int index1, int index2);
88  };
89 
90  using GMMReducerPtr = std::shared_ptr<GMMReducer>;
91 
92 }
93 
memoryx::eOrientedBBox
@ eOrientedBBox
Definition: GMMReducer.h:40
memoryx::GMMCompPairDistanceVector
std::vector< GMMCompPairDistance > GMMCompPairDistanceVector
Definition: GMMReducer.h:45
memoryx::GMMCompPairDistance
std::pair< int, float > GMMCompPairDistance
Definition: GMMReducer.h:44
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
memoryx::DeviationMeasure
DeviationMeasure
Definition: GMMReducer.h:37
GMMDistance.h
IceInternal::Handle
Definition: forward_declarations.h:8
memoryx::eAABB
@ eAABB
Definition: GMMReducer.h:39
memoryx::GMMReducer
Definition: GMMReducer.h:51
memoryx::eEqualSphere
@ eEqualSphere
Definition: GMMReducer.h:41
ProbabilityMeasures.h
memoryx::GMMDistancePtr
std::shared_ptr< GMMDistance > GMMDistancePtr
Definition: GMMDistance.h:61
ImportExport.h
ARMARXCORE_IMPORT_EXPORT
#define ARMARXCORE_IMPORT_EXPORT
Definition: ImportExport.h:38
memoryx::GMMReducer::gmmDistance
GMMDistancePtr gmmDistance
Definition: GMMReducer.h:77
memoryx::GMMReducerPtr
std::shared_ptr< GMMReducer > GMMReducerPtr
Definition: GMMReducer.h:90
memoryx::GMMReducer::GMMReducer
GMMReducer()
Creates a new GMMReducer.
Definition: GMMReducer.h:57