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 <limits.h>
29 #include <stdlib.h>
30 
31 #include <cmath>
32 
33 // PCL input/output
34 #include <pcl/console/parse.h>
35 #include <pcl/io/pcd_io.h>
36 
37 //PCL other
38 #include <pcl/filters/passthrough.h>
39 #include <pcl/segmentation/supervoxel_clustering.h>
40 
41 // The segmentation class this example is for
42 #include <pcl/segmentation/lccp_segmentation.h>
43 
44 namespace visionx
45 {
46  class PointCloudSegmenter;
47 }
48 
50 {
51 
53 
54 private:
55  using PointT = pcl::PointXYZRGBA; // The point type used for input
56  using SuperVoxelAdjacencyList = pcl::LCCPSegmentation<PointT>::SupervoxelAdjacencyList;
57 
58 
59  pcl::PointCloud<pcl::PointXYZL>::Ptr sv_labeled_cloud;
60  pcl::PointCloud<pcl::PointXYZL>::Ptr lccp_labeled_cloud;
61 
62  pcl::PointCloud<PointT>::Ptr input_cloud_ptr;
63  pcl::PointCloud<pcl::Normal>::Ptr input_normals_ptr;
64 
65  float normals_scale;
66  bool has_normals;
67 
68  /// Default values of parameters before parsing
69  // Supervoxel Stuff
70  float voxel_resolution;
71  float seed_resolution;
72  float color_importance;
73  float spatial_importance;
74  float normal_importance;
75  bool use_single_cam_transform;
76  bool use_supervoxel_refinement;
77 
78  // LCCPSegmentation Stuff
79  float concavity_tolerance_threshold;
80  float smoothness_threshold;
81  uint32_t min_segment_size;
82  bool use_extended_convexity;
83  bool use_sanity_criterion;
84 
85  // Segmentation Stuff
86  uint k_factor;
87 
88  bool SegmentPointCloud();
89 
90  std::map<uint32_t, pcl::Supervoxel<PointT>::Ptr> supervoxel_clusters;
91 
92 public:
93  LCCPSegClass();
94 
95  pcl::PointCloud<pcl::PointXYZL>::Ptr&
96  GetLabeledPointCloud(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr& CloudPtr);
97 
98  size_t
100  {
101  return supervoxel_clusters.size();
102  };
103 
104  void UpdateParameters(float voxelRes,
105  float seedRes,
106  float colorImp,
107  float spatialImp,
108  float normalImp,
109  float concavityThres,
110  float smoothnessThes,
111  uint32_t minSegSize);
112 
113 
114  ~LCCPSegClass();
115 };
visionx::PointCloudSegmenter
A brief description.
Definition: PointCloudSegmenter.h:154
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
LCCPSegClass::LCCPSegClass
LCCPSegClass()
Definition: LCCP_Segmenter.cpp:27
LCCPSegClass::~LCCPSegClass
~LCCPSegClass()
Definition: LCCP_Segmenter.cpp:70
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:175
LCCPSegClass
Definition: LCCP_Segmenter.h:49
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