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

Function main

test/visualization/test_visualization.cpp:225–288  ·  view source on GitHub ↗

---[ */

Source from the content-addressed store, hash-verified

223
224/* ---[ */
225int
226main (int argc, char** argv)
227{
228 if (argc < 2)
229 {
230 std::cerr << "No test file given. Please download `bunny.pcd` and pass its path to the test." << std::endl;
231 return (-1);
232 }
233
234 // Load file
235 pcl::PCLPointCloud2 cloud_blob;
236 loadPCDFile (argv[1], cloud_blob);
237 fromPCLPointCloud2 (cloud_blob, *cloud);
238
239 // Create search tree
240 tree.reset (new search::KdTree<PointXYZ> (false));
241 tree->setInputCloud (cloud);
242
243 // Normal estimation
244 NormalEstimation<PointXYZ, Normal> n;
245 PointCloud<Normal>::Ptr normals (new PointCloud<Normal> ());
246 n.setInputCloud (cloud);
247 //n.setIndices (indices[B);
248 n.setSearchMethod (tree);
249 n.setKSearch (20);
250 n.compute (*normals);
251
252 // Concatenate XYZ and normal information
253 pcl::concatenateFields (*cloud, *normals, *cloud_with_normals);
254
255 // Create search tree
256 tree2.reset (new search::KdTree<PointNormal>);
257 tree2->setInputCloud (cloud_with_normals);
258
259 // Process for update cloud
260 if (argc == 3)
261 {
262 pcl::PCLPointCloud2 cloud_blob1;
263 loadPCDFile (argv[2], cloud_blob1);
264 fromPCLPointCloud2 (cloud_blob1, *cloud1);
265 // Create search tree
266 tree3.reset (new search::KdTree<PointXYZ> (false));
267 tree3->setInputCloud (cloud1);
268
269 // Normal estimation
270 NormalEstimation<PointXYZ, Normal> n1;
271 PointCloud<Normal>::Ptr normals1 (new PointCloud<Normal> ());
272 n1.setInputCloud (cloud1);
273
274 n1.setSearchMethod (tree3);
275 n1.setKSearch (20);
276 n1.compute (*normals1);
277
278 // Concatenate XYZ and normal information
279 pcl::concatenateFields (*cloud1, *normals1, *cloud_with_normals1);
280 // Create search tree
281 tree4.reset (new search::KdTree<PointNormal>);
282 tree4->setInputCloud (cloud_with_normals1);

Callers

nothing calls this directly

Calls 8

loadPCDFileFunction · 0.85
fromPCLPointCloud2Function · 0.85
concatenateFieldsFunction · 0.85
resetMethod · 0.45
setInputCloudMethod · 0.45
setSearchMethodMethod · 0.45
setKSearchMethod · 0.45
computeMethod · 0.45

Tested by

no test coverage detected