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

Function main

examples/features/example_difference_of_normals.cpp:31–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29using SearchPtr = pcl::search::Search<PointT>::Ptr;
30
31int main (int argc, char *argv[])
32{
33 ///The smallest scale to use in the DoN filter.
34 constexpr double scale1 = 0.2;
35
36 ///The largest scale to use in the DoN filter.
37 constexpr double scale2 = 2.0;
38
39 ///The minimum DoN magnitude to threshold by
40 constexpr double threshold = 0.25;
41
42 ///segment scene into clusters with given distance tolerance using euclidean clustering
43 double segradius = 0.2;
44
45 //voxelization factor of pointcloud to use in approximation of normals
46 bool approx = false;
47 constexpr double decimation = 100;
48
49 if(argc < 3){
50 std::cerr << "Expected 2 arguments: inputfile outputfile" << std::endl;
51 return 0;
52 }
53
54 ///The file to read from.
55 std::string infile = argv[1];
56
57 ///The file to output to.
58 std::string outfile = argv[2];
59
60 // Load cloud in blob format
61 pcl::PCLPointCloud2 blob;
62 pcl::io::loadPCDFile (infile, blob);
63
64 pcl::PointCloud<PointT>::Ptr cloud (new pcl::PointCloud<PointT>);
65 std::cout << "Loading point cloud...";
66 pcl::fromPCLPointCloud2 (blob, *cloud);
67 std::cout << "done." << std::endl;
68
69 SearchPtr tree;
70
71 if (cloud->isOrganized ())
72 {
73 tree.reset (new pcl::search::OrganizedNeighbor<PointT> ());
74 }
75 else
76 {
77 tree.reset (new pcl::search::KdTree<PointT> (false));
78 }
79
80 tree->setInputCloud (cloud);
81
82 PointCloud<PointT>::Ptr small_cloud_downsampled;
83 PointCloud<PointT>::Ptr large_cloud_downsampled;
84
85 // If we are using approximation
86 if(approx){
87 std::cout << "Downsampling point cloud for approximation" << std::endl;
88

Callers

nothing calls this directly

Calls 15

loadPCDFileFunction · 0.85
fromPCLPointCloud2Function · 0.85
copyPointCloudFunction · 0.85
isOrganizedMethod · 0.80
setDownsampleAllDataMethod · 0.80
setLeafSizeMethod · 0.80
setNormalScaleLargeMethod · 0.80
setNormalScaleSmallMethod · 0.80
addComparisonMethod · 0.80
setConditionMethod · 0.80
lengthMethod · 0.80
strMethod · 0.80

Tested by

no test coverage detected