LCCP_Segmenter.h
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 VisionX
19  * @author Eren Aksoy ( eren dot aksoy at kit dot edu )
20  * @date 2015
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 
25 #pragma once
26 
27 // Stdlib
28 #include <stdlib.h>
29 #include <cmath>
30 #include <limits.h>
31 
32 // PCL input/output
33 #include <pcl/console/parse.h>
34 #include <pcl/io/pcd_io.h>
35 
36 //PCL other
37 #include <pcl/filters/passthrough.h>
38 #include <pcl/segmentation/supervoxel_clustering.h>
39 
40 // The segmentation class this example is for
41 #include <pcl/segmentation/lccp_segmentation.h>
42 
43 
44 namespace visionx
45 {
46  class PointCloudSegmenter;
47 }
48 
49 
51 {
52 
54 
55 private:
56 
57  using PointT = pcl::PointXYZRGBA; // The point type used for input
58  using SuperVoxelAdjacencyList = pcl::LCCPSegmentation<PointT>::SupervoxelAdjacencyList;
59 
60 
61  pcl::PointCloud<pcl::PointXYZL>::Ptr sv_labeled_cloud;
62  pcl::PointCloud<pcl::PointXYZL>::Ptr lccp_labeled_cloud;
63 
64  pcl::PointCloud<PointT>::Ptr input_cloud_ptr;
65  pcl::PointCloud<pcl::Normal>::Ptr input_normals_ptr;
66 
67  float normals_scale;
68  bool has_normals;
69 
70  /// Default values of parameters before parsing
71  // Supervoxel Stuff
72  float voxel_resolution;
73  float seed_resolution;
74  float color_importance;
75  float spatial_importance;
76  float normal_importance;
77  bool use_single_cam_transform;
78  bool use_supervoxel_refinement;
79 
80  // LCCPSegmentation Stuff
81  float concavity_tolerance_threshold;
82  float smoothness_threshold;
83  uint32_t min_segment_size;
84  bool use_extended_convexity;
85  bool use_sanity_criterion;
86 
87  // Segmentation Stuff
88  uint k_factor;
89 
90  bool SegmentPointCloud();
91 
92  std::map<uint32_t, pcl::Supervoxel<PointT>::Ptr> supervoxel_clusters;
93 
94 public:
95 
96  LCCPSegClass();
97 
98  pcl::PointCloud<pcl::PointXYZL>::Ptr& GetLabeledPointCloud(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr& CloudPtr);
100  {
101  return supervoxel_clusters.size();
102  };
103 
104  void UpdateParameters(float voxelRes, float seedRes, float colorImp, float spatialImp, float normalImp, float concavityThres, float smoothnessThes, uint32_t minSegSize);
105 
106 
107  ~LCCPSegClass();
108 };
109 
visionx::PointCloudSegmenter
A brief description.
Definition: PointCloudSegmenter.h:123
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
LCCPSegClass::LCCPSegClass
LCCPSegClass()
Definition: LCCP_Segmenter.cpp:28
LCCPSegClass::~LCCPSegClass
~LCCPSegClass()
Definition: LCCP_Segmenter.cpp:71
LCCPSegClass::UpdateParameters
void UpdateParameters(float voxelRes, float seedRes, float colorImp, float spatialImp, float normalImp, float concavityThres, float smoothnessThes, uint32_t minSegSize)
Definition: LCCP_Segmenter.cpp:170
LCCPSegClass
Definition: LCCP_Segmenter.h:50
LCCPSegClass::GetSuperVoxelClusterSize
size_t GetSuperVoxelClusterSize()
Definition: LCCP_Segmenter.h:99
LCCPSegClass::GetLabeledPointCloud
pcl::PointCloud< pcl::PointXYZL >::Ptr & GetLabeledPointCloud(pcl::PointCloud< pcl::PointXYZRGBA >::Ptr &CloudPtr)
Definition: LCCP_Segmenter.cpp:77