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

Function main

tools/uniform_sampling.cpp:153–198  ·  view source on GitHub ↗

---[ */

Source from the content-addressed store, hash-verified

151
152/* ---[ */
153int
154main (int argc, char** argv)
155{
156 print_info ("Uniform subsampling using UniformSampling. For more information, use: %s -h\n", argv[0]);
157
158 if (argc < 3)
159 {
160 printHelp (argc, argv);
161 return (-1);
162 }
163
164 // Parse the command line arguments for .pcd files
165 std::vector<int> p_file_indices;
166 std::vector<std::string> extension;
167 extension.emplace_back(".pcd");
168 extension.emplace_back(".ply");
169 extension.emplace_back(".vtk");
170 p_file_indices = parse_file_extension_argument (argc, argv, extension);
171
172 if (p_file_indices.size () != 2)
173 {
174 print_error ("Need one input file and one output file to continue.\n");
175 return (-1);
176 }
177
178 std::string input_filename = argv[p_file_indices[0]];
179 std::string output_filename = argv[p_file_indices[1]];
180
181 // Command line parsing
182 double radius = default_radius;
183 parse_argument (argc, argv, "-radius", radius);
184 print_info ("Extracting uniform points with a leaf size of: ");
185 print_value ("%f\n", radius);
186
187 // Load the first file
188 pcl::PCLPointCloud2::Ptr cloud (new pcl::PCLPointCloud2);
189 if (!loadCloud (input_filename, *cloud))
190 return (-1);
191
192 // Perform the keypoint estimation
193 pcl::PCLPointCloud2 output;
194 compute (cloud, output, radius);
195
196 // Save into the second file
197 saveCloud (output_filename, output);
198}

Callers

nothing calls this directly

Calls 8

parse_argumentFunction · 0.85
print_valueFunction · 0.85
emplace_backMethod · 0.80
printHelpFunction · 0.70
loadCloudFunction · 0.70
computeFunction · 0.70
saveCloudFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected