FeatureCalculator.hpp
Go to the documentation of this file.
1
/*
2
* This file is part of ArmarX.
3
*
4
* Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5
*
6
* ArmarX is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License version 2 as
8
* published by the Free Software Foundation.
9
*
10
* ArmarX is distributed in the hope that it will be useful, but
11
* WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*
18
* @package
19
* @author
20
* @date
21
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22
* GNU General Public License
23
*/
24
#pragma once
25
26
#include <functional>
27
#include <map>
28
#include <memory>
29
#include <string>
30
#include <utility>
31
#include <vector>
32
33
#include "
Feature.hpp
"
34
35
class
FeatureCalculator
36
{
37
public
:
38
using
Points
= std::vector<Eigen::Vector3f>;
39
40
template
<
class
F>
41
void
42
addFeature
()
43
{
44
features.push_back(
FeaturePtr
(
new
F()));
45
}
46
47
// Due to bug in GCC, this won't work in GCC versions smaller than 4.9. See GCC bug 41933
48
49
// template<class F, class... Args>
50
// void addFeature(Args... args) {
51
// featureCtors.push_back([&](std::vector<Eigen::Vector3f> &points) {
52
// return F(points, args...);
53
// });
54
// }
55
56
std::map<std::string, FeaturePtr>
57
getFeatures
(
const
Points
& points)
58
{
59
std::map<std::string, FeaturePtr> fs;
60
61
for
(
auto
& f : features)
62
{
63
FeaturePtr
feature = f->calculate(points);
64
fs[feature->name()] = feature;
65
}
66
67
return
fs;
68
}
69
70
std::map<std::string, FeaturePtr>
71
getFeatures
(
const
std::pair<std::string, Points>& points)
72
{
73
std::map<std::string, FeaturePtr> fs;
74
75
for
(
auto
& f : features)
76
{
77
FeaturePtr
feature = f->calculate(points);
78
fs[feature->name()] = feature;
79
}
80
81
return
fs;
82
}
83
84
private
:
85
std::vector<FeaturePtr> features;
86
};
Feature.hpp
FeaturePtr
std::shared_ptr< Feature > FeaturePtr
Definition
Feature.hpp:104
FeatureCalculator
Definition
FeatureCalculator.hpp:36
FeatureCalculator::getFeatures
std::map< std::string, FeaturePtr > getFeatures(const Points &points)
Definition
FeatureCalculator.hpp:57
FeatureCalculator::Points
std::vector< Eigen::Vector3f > Points
Definition
FeatureCalculator.hpp:38
FeatureCalculator::addFeature
void addFeature()
Definition
FeatureCalculator.hpp:42
FeatureCalculator::getFeatures
std::map< std::string, FeaturePtr > getFeatures(const std::pair< std::string, Points > &points)
Definition
FeatureCalculator.hpp:71
VisionX
components
pointcloud_processor
ObjectShapeClassification
Features
FeatureCalculator.hpp
Generated by
1.13.2