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

Function main

tools/train_linemod_template.cpp:230–310  ·  view source on GitHub ↗

---[ */

Source from the content-addressed store, hash-verified

228
229/* ---[ */
230int
231main (int argc, char** argv)
232{
233 print_info ("Train one or more linemod templates. For more information, use: %s -h\n", argv[0]);
234
235 // If no arguments are given, print the help text
236 if (argc == 1)
237 {
238 printHelp (argc, argv);
239 return (-1);
240 }
241
242 // Parse the command line arguments for .pcd files
243 std::vector<int> p_file_indices;
244 p_file_indices = parse_file_extension_argument (argc, argv, ".pcd");
245 if (p_file_indices.empty ())
246 {
247 print_error ("Need at least one input PCD file.\n");
248 return (-1);
249 }
250
251 // Parse the min_depth, max_depth, and max_height parameters
252 float min_depth = 0;
253 parse_argument (argc, argv, "-min_depth", min_depth);
254
255 float max_depth = std::numeric_limits<float>::max ();
256 parse_argument (argc, argv, "-max_depth", max_depth);
257
258 float max_height = std::numeric_limits<float>::max ();
259 parse_argument (argc, argv, "-max_height", max_height);
260
261 int error_code = 0;
262 bool processed_at_least_one_pcd = false;
263
264 // Segment and create templates for each input file
265 for (const int &p_file_index : p_file_indices)
266 {
267 // Load input file
268 const std::string input_filename = argv[p_file_index];
269 PointCloudXYZRGBA::Ptr cloud (new PointCloudXYZRGBA);
270
271 if (!loadCloud (input_filename, *cloud))
272 {
273 error_code = -1;
274 std::string warn_msg = "Could not load point cloud from file: " + input_filename + "\n";
275 print_warn (warn_msg.c_str ());
276 continue;
277 }
278
279 if (!cloud->isOrganized())
280 {
281 std::string warn_msg = "Unorganized point cloud detected. Skipping file " + input_filename + "\n";
282 print_warn(warn_msg.c_str());
283 continue;
284 }
285 else
286 {
287 processed_at_least_one_pcd = true;

Callers

nothing calls this directly

Calls 8

parse_argumentFunction · 0.85
isOrganizedMethod · 0.80
lengthMethod · 0.80
printHelpFunction · 0.70
loadCloudFunction · 0.70
computeFunction · 0.70
maxFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected