MCPcopy Create free account
hub / github.com/PointCloudLibrary/pcl / compute

Function compute

apps/src/pcd_organized_edge_detection.cpp:167–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165}
166
167void
168compute(const pcl::PCLPointCloud2::ConstPtr& input,
169 pcl::PCLPointCloud2& output,
170 float th_dd,
171 int max_search)
172{
173 CloudPtr cloud(new Cloud);
174 fromPCLPointCloud2(*input, *cloud);
175
176 pcl::PointCloud<pcl::Normal>::Ptr normal(new pcl::PointCloud<pcl::Normal>);
177 pcl::IntegralImageNormalEstimation<PointXYZRGBA, pcl::Normal> ne;
178 ne.setNormalEstimationMethod(ne.COVARIANCE_MATRIX);
179 ne.setNormalSmoothingSize(10.0f);
180 ne.setBorderPolicy(ne.BORDER_POLICY_MIRROR);
181 ne.setInputCloud(cloud);
182 ne.compute(*normal);
183
184 TicToc tt;
185 tt.tic();
186
187 // OrganizedEdgeBase<PointXYZRGBA, Label> oed;
188 // OrganizedEdgeFromRGB<PointXYZRGBA, Label> oed;
189 // OrganizedEdgeFromNormals<PointXYZRGBA, Normal, Label> oed;
190 OrganizedEdgeFromRGBNormals<PointXYZRGBA, Normal, Label> oed;
191 oed.setInputNormals(normal);
192 oed.setInputCloud(cloud);
193 oed.setDepthDisconThreshold(th_dd);
194 oed.setMaxSearchNeighbors(max_search);
195 oed.setEdgeType(oed.EDGELABEL_NAN_BOUNDARY | oed.EDGELABEL_OCCLUDING |
196 oed.EDGELABEL_OCCLUDED | oed.EDGELABEL_HIGH_CURVATURE |
197 oed.EDGELABEL_RGB_CANNY);
198 PointCloud<Label> labels;
199 std::vector<PointIndices> label_indices;
200 oed.compute(labels, label_indices);
201 print_info("Detecting all edges... [done, ");
202 print_value("%g", tt.toc());
203 print_info(" ms]\n");
204
205 // Make gray point clouds
206 for (auto& point : cloud->points) {
207 std::uint8_t gray = std::uint8_t((point.r + point.g + point.b) / 3);
208 point.r = point.g = point.b = gray;
209 }
210
211 // Display edges in PCLVisualizer
212 viewer.setSize(640, 480);
213 viewer.addCoordinateSystem(0.2f, "global");
214 viewer.addPointCloud(cloud, "original point cloud");
215 viewer.registerKeyboardCallback(&keyboard_callback);
216
217 pcl::PointCloud<pcl::PointXYZRGBA>::Ptr occluding_edges(
218 new pcl::PointCloud<pcl::PointXYZRGBA>),
219 occluded_edges(new pcl::PointCloud<pcl::PointXYZRGBA>),
220 nan_boundary_edges(new pcl::PointCloud<pcl::PointXYZRGBA>),
221 high_curvature_edges(new pcl::PointCloud<pcl::PointXYZRGBA>),
222 rgb_edges(new pcl::PointCloud<pcl::PointXYZRGBA>);
223
224 pcl::copyPointCloud(*cloud, label_indices[0].indices, *nan_boundary_edges);

Callers 1

mainFunction · 0.70

Calls 15

fromPCLPointCloud2Function · 0.85
print_valueFunction · 0.85
copyPointCloudFunction · 0.85
toPCLPointCloud2Function · 0.85
concatenateFieldsFunction · 0.85
setBorderPolicyMethod · 0.80
ticMethod · 0.80
setMaxSearchNeighborsMethod · 0.80
setEdgeTypeMethod · 0.80
tocMethod · 0.80

Tested by

no test coverage detected