PrimitiveExtractionParameterTuning.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 VisionX::ArmarXObjects::PrimitiveExtractionParameterTuning
17  * @author Peter Kaiser ( peter dot kaiser at kit dot edu )
18  * @date 2017
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
26 
28 #include <VisionX/interface/components/FakePointCloudProviderInterface.h>
29 #include <VisionX/interface/components/PointCloudSegmenter.h>
30 #include <VisionX/interface/components/PrimitiveMapper.h>
31 
32 #include <pcl/io/pcd_io.h>
33 #include <pcl/point_types.h>
34 
35 namespace armarx
36 {
37  /**
38  * @class PrimitiveExtractionParameterTuningPropertyDefinitions
39  * @brief
40  */
43  {
44  public:
47  {
48  defineRequiredProperty<std::string>("SourcePointCloud", "A XYZRGBA source truth point cloud");
49  defineRequiredProperty<std::string>("GroundTruthPointCloud", "A XYZRGBL ground truth point cloud");
50  defineOptionalProperty<std::string>("PointCloudProviderName", "FakePointCloudProvider", "The name of the point cloud provider");
51  defineOptionalProperty<std::string>("PointCloudSegmenterName", "PointCloudSegmenter", "The name of the point cloud segmenter");
52  defineOptionalProperty<std::string>("PrimitiveExtractorName", "PrimitiveExtractor", "The name of the point cloud provider");
53  defineOptionalProperty<std::string>("PrimitivesProviderName", "PrimitiveExtractorResult", "The name of the primitive provider");
54  defineRequiredProperty<std::string>("ExportDirectory", "The name of the directory to export point clouds and setup files");
55  }
56  };
57 
58  /**
59  * @defgroup Component-PrimitiveExtractionParameterTuning PrimitiveExtractionParameterTuning
60  * @ingroup VisionX-Components
61  * A description of the component PrimitiveExtractionParameterTuning.
62  *
63  * @class PrimitiveExtractionParameterTuning
64  * @ingroup Component-PrimitiveExtractionParameterTuning
65  * @brief Brief description of class PrimitiveExtractionParameterTuning.
66  *
67  * Detailed description of class PrimitiveExtractionParameterTuning.
68  */
70  virtual public visionx::PointCloudProcessor
71  {
72  public:
73  /**
74  * @see armarx::ManagedIceObject::getDefaultName()
75  */
76  std::string getDefaultName() const override
77  {
78  return "PrimitiveExtractionParameterTuning";
79  }
80 
81  protected:
82  /**
83  * @see visionx::PointCloudProcessor::onInitPointCloudProcessor()
84  */
85  void onInitPointCloudProcessor() override;
86 
87  /**
88  * @see visionx::PointCloudProcessor::onConnectPointCloudProcessor()
89  */
90  void onConnectPointCloudProcessor() override;
91 
92  /**
93  * @see visionx::PointCloudProcessor::onDisconnectPointCloudProcessor()
94  */
95  void onDisconnectPointCloudProcessor() override;
96 
97  /**
98  * @see visionx::PointCloudProcessor::onExitPointCloudProcessor()
99  */
100  void onExitPointCloudProcessor() override;
101 
102  /**
103  * @see visionx::PointCloudProcessor::process()
104  */
105  void process() override;
106 
107  /**
108  * @see PropertyUser::createPropertyDefinitions()
109  */
111 
112  float compareLabeledPointClouds(const pcl::PointCloud<pcl::PointXYZL>::Ptr& labeled, const pcl::PointCloud<pcl::PointXYZRGBL>::Ptr& reference);
114 
115  float sample(float current, const Eigen::Vector2f& bounds);
116  void exportBestSetup(const std::string& directory, const pcl::PointCloud<pcl::PointXYZL>::Ptr& pointCloud, const visionx::LccpParameters& lccp_prm, const visionx::PrimitiveExtractorParameters& pe_prm);
117 
118  protected:
122  std::string exportDirectory;
123 
124  visionx::FakePointCloudProviderInterfacePrx pointCloudProvider;
125  visionx::PointCloudSegmenterInterfacePrx pointCloudSegmenter;
126  visionx::PrimitiveMapperInterfacePrx primitiveExtractor;
127 
128  pcl::PointCloud<pcl::PointXYZRGBL>::Ptr referencePointCloud;
129 
130  visionx::PrimitiveExtractorParameters extractionPrm;
131  visionx::LccpParameters segmentationPrm;
132 
133  visionx::PrimitiveExtractorParameters bestExtractionPrm;
134  visionx::LccpParameters bestSegmentationPrm;
135  float bestFitness;
136 
137  unsigned int iteration = 0;
138 
161  };
162 }
163 
armarx::PrimitiveExtractionParameterTuning::primitiveExtractor
visionx::PrimitiveMapperInterfacePrx primitiveExtractor
Definition: PrimitiveExtractionParameterTuning.h:126
armarx::PrimitiveExtractionParameterTuningPropertyDefinitions::PrimitiveExtractionParameterTuningPropertyDefinitions
PrimitiveExtractionParameterTuningPropertyDefinitions(std::string prefix)
Definition: PrimitiveExtractionParameterTuning.h:45
armarx::PrimitiveExtractionParameterTuning::bounds_primitives_voxelResolution
Eigen::Vector2f bounds_primitives_voxelResolution
Definition: PrimitiveExtractionParameterTuning.h:154
armarx::PrimitiveExtractionParameterTuning::compareLabeledPointClouds
float compareLabeledPointClouds(const pcl::PointCloud< pcl::PointXYZL >::Ptr &labeled, const pcl::PointCloud< pcl::PointXYZRGBL >::Ptr &reference)
Definition: PrimitiveExtractionParameterTuning.cpp:202
armarx::PrimitiveExtractionParameterTuning::onExitPointCloudProcessor
void onExitPointCloudProcessor() override
Definition: PrimitiveExtractionParameterTuning.cpp:153
armarx::PrimitiveExtractionParameterTuning::sourcePointCloudFilename
std::string sourcePointCloudFilename
Definition: PrimitiveExtractionParameterTuning.h:120
armarx::PrimitiveExtractionParameterTuning::bounds_primitives_concavityThreshold
Eigen::Vector2f bounds_primitives_concavityThreshold
Definition: PrimitiveExtractionParameterTuning.h:159
armarx::PrimitiveExtractionParameterTuningPropertyDefinitions
Definition: PrimitiveExtractionParameterTuning.h:41
armarx::PrimitiveExtractionParameterTuning::bestSegmentationPrm
visionx::LccpParameters bestSegmentationPrm
Definition: PrimitiveExtractionParameterTuning.h:134
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:333
armarx::PrimitiveExtractionParameterTuning::bounds_segmentation_maxSegmentSize
Eigen::Vector2f bounds_segmentation_maxSegmentSize
Definition: PrimitiveExtractionParameterTuning.h:140
armarx::PrimitiveExtractionParameterTuning::bounds_primitives_spatialImportance
Eigen::Vector2f bounds_primitives_spatialImportance
Definition: PrimitiveExtractionParameterTuning.h:157
armarx::PrimitiveExtractionParameterTuning::onInitPointCloudProcessor
void onInitPointCloudProcessor() override
Definition: PrimitiveExtractionParameterTuning.cpp:32
armarx::PrimitiveExtractionParameterTuning::bounds_segmentation_planeDistanceThreshold
Eigen::Vector2f bounds_segmentation_planeDistanceThreshold
Definition: PrimitiveExtractionParameterTuning.h:144
armarx::PrimitiveExtractionParameterTuning::bounds_segmentation_minSegmentSize
Eigen::Vector2f bounds_segmentation_minSegmentSize
Definition: PrimitiveExtractionParameterTuning.h:139
armarx::PrimitiveExtractionParameterTuning::exportBestSetup
void exportBestSetup(const std::string &directory, const pcl::PointCloud< pcl::PointXYZL >::Ptr &pointCloud, const visionx::LccpParameters &lccp_prm, const visionx::PrimitiveExtractorParameters &pe_prm)
Definition: PrimitiveExtractionParameterTuning.cpp:317
armarx::PrimitiveExtractionParameterTuning::bounds_primitives_colorImportance
Eigen::Vector2f bounds_primitives_colorImportance
Definition: PrimitiveExtractionParameterTuning.h:156
armarx::PrimitiveExtractionParameterTuning::exportDirectory
std::string exportDirectory
Definition: PrimitiveExtractionParameterTuning.h:122
armarx::PrimitiveExtractionParameterTuning::bounds_segmentation_sphereMaxIterations
Eigen::Vector2f bounds_segmentation_sphereMaxIterations
Definition: PrimitiveExtractionParameterTuning.h:149
armarx::PrimitiveExtractionParameterTuning::process
void process() override
Definition: PrimitiveExtractionParameterTuning.cpp:158
armarx::PrimitiveExtractionParameterTuning::bounds_primitives_normalImportance
Eigen::Vector2f bounds_primitives_normalImportance
Definition: PrimitiveExtractionParameterTuning.h:158
visionx::PointCloudProcessor
The PointCloudProcessor class provides an interface for access to PointCloudProviders via Ice and sha...
Definition: PointCloudProcessor.h:186
armarx::PrimitiveExtractionParameterTuning::referencePointCloudFilename
std::string referencePointCloudFilename
Definition: PrimitiveExtractionParameterTuning.h:121
armarx::PrimitiveExtractionParameterTuning::pointCloudSegmenter
visionx::PointCloudSegmenterInterfacePrx pointCloudSegmenter
Definition: PrimitiveExtractionParameterTuning.h:125
armarx::PrimitiveExtractionParameterTuning::bounds_segmentation_outlierThreshold
Eigen::Vector2f bounds_segmentation_outlierThreshold
Definition: PrimitiveExtractionParameterTuning.h:142
armarx::PrimitiveExtractionParameterTuning::bounds_segmentation_euclideanClusteringTolerance
Eigen::Vector2f bounds_segmentation_euclideanClusteringTolerance
Definition: PrimitiveExtractionParameterTuning.h:141
armarx::PrimitiveExtractionParameterTuning::bounds_segmentation_sphereNormalDistance
Eigen::Vector2f bounds_segmentation_sphereNormalDistance
Definition: PrimitiveExtractionParameterTuning.h:151
armarx::PrimitiveExtractionParameterTuning::bounds_segmentation_cylinderRadiusLimit
Eigen::Vector2f bounds_segmentation_cylinderRadiusLimit
Definition: PrimitiveExtractionParameterTuning.h:148
PointCloudProcessor.h
armarx::PrimitiveExtractionParameterTuning::bounds_primitives_seedResolution
Eigen::Vector2f bounds_primitives_seedResolution
Definition: PrimitiveExtractionParameterTuning.h:155
armarx::PrimitiveExtractionParameterTuning::bounds_primitives_minSegmentSize
Eigen::Vector2f bounds_primitives_minSegmentSize
Definition: PrimitiveExtractionParameterTuning.h:153
armarx::PrimitiveExtractionParameterTuning::pointCloudProvider
visionx::FakePointCloudProviderInterfacePrx pointCloudProvider
Definition: PrimitiveExtractionParameterTuning.h:124
armarx::PrimitiveExtractionParameterTuning::bounds_segmentation_cylinderDistanceThreshold
Eigen::Vector2f bounds_segmentation_cylinderDistanceThreshold
Definition: PrimitiveExtractionParameterTuning.h:147
Component.h
armarx::PrimitiveExtractionParameterTuning::bounds_segmentation_sphereDistanceThreshold
Eigen::Vector2f bounds_segmentation_sphereDistanceThreshold
Definition: PrimitiveExtractionParameterTuning.h:150
armarx::PrimitiveExtractionParameterTuning::bounds_segmentation_planeNormalDistance
Eigen::Vector2f bounds_segmentation_planeNormalDistance
Definition: PrimitiveExtractionParameterTuning.h:145
armarx::PrimitiveExtractionParameterTuning::referencePointCloud
pcl::PointCloud< pcl::PointXYZRGBL >::Ptr referencePointCloud
Definition: PrimitiveExtractionParameterTuning.h:128
armarx::PrimitiveExtractionParameterTuning::bounds_primitives_smoothnessThreshold
Eigen::Vector2f bounds_primitives_smoothnessThreshold
Definition: PrimitiveExtractionParameterTuning.h:160
armarx::PrimitiveExtractionParameterTuning::generateNewParameterSet
void generateNewParameterSet()
Definition: PrimitiveExtractionParameterTuning.cpp:240
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:70
armarx::PrimitiveExtractionParameterTuning::bounds_segmentation_planeMaxIterations
Eigen::Vector2f bounds_segmentation_planeMaxIterations
Definition: PrimitiveExtractionParameterTuning.h:143
armarx::PrimitiveExtractionParameterTuning::iteration
unsigned int iteration
Definition: PrimitiveExtractionParameterTuning.h:137
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::PrimitiveExtractionParameterTuning::onDisconnectPointCloudProcessor
void onDisconnectPointCloudProcessor() override
Definition: PrimitiveExtractionParameterTuning.cpp:148
armarx::PrimitiveExtractionParameterTuning::sample
float sample(float current, const Eigen::Vector2f &bounds)
Definition: PrimitiveExtractionParameterTuning.cpp:295
armarx::PrimitiveExtractionParameterTuning::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: PrimitiveExtractionParameterTuning.cpp:197
armarx::PrimitiveExtractionParameterTuning
Brief description of class PrimitiveExtractionParameterTuning.
Definition: PrimitiveExtractionParameterTuning.h:69
armarx::PrimitiveExtractionParameterTuning::primitivesProviderName
std::string primitivesProviderName
Definition: PrimitiveExtractionParameterTuning.h:119
armarx::PrimitiveExtractionParameterTuning::bestFitness
float bestFitness
Definition: PrimitiveExtractionParameterTuning.h:135
armarx::PrimitiveExtractionParameterTuning::bounds_segmentation_circularDistanceThreshold
Eigen::Vector2f bounds_segmentation_circularDistanceThreshold
Definition: PrimitiveExtractionParameterTuning.h:152
armarx::PrimitiveExtractionParameterTuning::onConnectPointCloudProcessor
void onConnectPointCloudProcessor() override
Definition: PrimitiveExtractionParameterTuning.cpp:116
armarx::PrimitiveExtractionParameterTuning::extractionPrm
visionx::PrimitiveExtractorParameters extractionPrm
Definition: PrimitiveExtractionParameterTuning.h:130
armarx::PrimitiveExtractionParameterTuning::segmentationPrm
visionx::LccpParameters segmentationPrm
Definition: PrimitiveExtractionParameterTuning.h:131
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::PrimitiveExtractionParameterTuning::bestExtractionPrm
visionx::PrimitiveExtractorParameters bestExtractionPrm
Definition: PrimitiveExtractionParameterTuning.h:133
armarx::PrimitiveExtractionParameterTuning::getDefaultName
std::string getDefaultName() const override
Definition: PrimitiveExtractionParameterTuning.h:76
armarx::PrimitiveExtractionParameterTuning::bounds_segmentation_cylinderMaxIterations
Eigen::Vector2f bounds_segmentation_cylinderMaxIterations
Definition: PrimitiveExtractionParameterTuning.h:146