30 input_cloud_ptr.reset(
new pcl::PointCloud<PointT>);
31 input_normals_ptr.reset(
new pcl::PointCloud<pcl::Normal>);
33 sv_labeled_cloud.reset(
new pcl::PointCloud<pcl::PointXYZL>);
34 lccp_labeled_cloud.reset(
new pcl::PointCloud<pcl::PointXYZL>);
40 voxel_resolution = 0.0095f;
41 seed_resolution = 0.06f;
42 color_importance = 0.0f;
43 spatial_importance = 1.0f;
44 normal_importance = 4.0f;
45 use_single_cam_transform =
false;
46 use_supervoxel_refinement =
false;
49 concavity_tolerance_threshold = 10;
50 smoothness_threshold = 0.1;
51 min_segment_size = 10;
52 use_extended_convexity =
false;
53 use_sanity_criterion =
false;
57 normals_scale = seed_resolution / 2.0;
62 if (use_extended_convexity)
76 pcl::PointCloud<pcl::PointXYZL>::Ptr&
80 pcl::copyPointCloud(*CloudPtr, *input_cloud_ptr);
84 return lccp_labeled_cloud;
90 LCCPSegClass::SegmentPointCloud()
95 pcl::SupervoxelClustering<PointT> super(voxel_resolution, seed_resolution);
96 super.setUseSingleCameraTransform(use_single_cam_transform);
98 super.setInputCloud(input_cloud_ptr);
102 super.setNormalCloud(input_normals_ptr);
105 super.setColorImportance(color_importance);
106 super.setSpatialImportance(spatial_importance);
107 super.setNormalImportance(normal_importance);
108 supervoxel_clusters.clear();
111 super.extract(supervoxel_clusters);
113 if (supervoxel_clusters.size() == 0)
120 if (use_supervoxel_refinement)
123 super.refineSupervoxels(2, supervoxel_clusters);
129 std::multimap<uint32_t, uint32_t> supervoxel_adjacency;
130 super.getSupervoxelAdjacency(supervoxel_adjacency);
133 pcl::PointCloud<pcl::PointNormal>::Ptr sv_centroid_normal_cloud =
134 pcl::SupervoxelClustering<PointT>::makeSupervoxelNormalCloud(supervoxel_clusters);
139 pcl::LCCPSegmentation<PointT> lccp;
140 lccp.setConcavityToleranceThreshold(concavity_tolerance_threshold);
141 lccp.setSanityCheck(use_sanity_criterion);
142 lccp.setSmoothnessCheck(
true, voxel_resolution, seed_resolution, smoothness_threshold);
143 lccp.setKFactor(k_factor);
147 if (min_segment_size > 0)
150 lccp.setMinSegmentSize(min_segment_size);
155 lccp.setInputSupervoxels(supervoxel_clusters, supervoxel_adjacency);
160 sv_labeled_cloud = super.getLabeledCloud();
161 lccp_labeled_cloud = sv_labeled_cloud->makeShared();
162 lccp.relabelCloud(*lccp_labeled_cloud);
163 SuperVoxelAdjacencyList sv_adjacency_list;
164 lccp.getSVAdjacencyList(sv_adjacency_list);
180 float concavityThres,
181 float smoothnessThes,
184 voxel_resolution = voxelRes;
185 seed_resolution = seedRes;
186 color_importance = colorImp;
187 spatial_importance = spatialImp;
188 normal_importance = normalImp;
189 concavity_tolerance_threshold = concavityThres;
190 smoothness_threshold = smoothnessThes;
191 min_segment_size = minSegSize;