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

Function main

tools/depth_sense_viewer.cpp:280–334  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278
279
280int
281main (int argc, char** argv)
282{
283 print_info ("Viewer for DepthSense devices (run with --help for more information)\n", argv[0]);
284
285 if (find_switch (argc, argv, "--help") || find_switch (argc, argv, "-h"))
286 {
287 printHelp (argc, argv);
288 return (0);
289 }
290
291 if (find_switch (argc, argv, "--list") || find_switch (argc, argv, "-l"))
292 {
293 printDeviceList ();
294 return (0);
295 }
296
297 bool xyz_only = find_switch (argc, argv, "--xyz");
298
299 std::string device_id;
300
301 if (argc == 1 || // no arguments
302 (argc == 2 && xyz_only)) // single argument, and it is --xyz
303 {
304 device_id = "";
305 print_info ("Creating a grabber for the first available device\n");
306 }
307 else
308 {
309 device_id = argv[argc - 1];
310 print_info ("Creating a grabber for device \"%s\"\n", device_id.c_str ());
311 }
312
313 try
314 {
315 pcl::DepthSenseGrabber grabber (device_id);
316 if (xyz_only)
317 {
318 DepthSenseViewer<pcl::PointXYZ> viewer (grabber);
319 viewer.run ();
320 }
321 else
322 {
323 DepthSenseViewer<pcl::PointXYZRGBA> viewer (grabber);
324 viewer.run ();
325 }
326 }
327 catch (pcl::io::IOException& e)
328 {
329 print_error ("Failed to create a grabber: %s\n", e.what ());
330 return (1);
331 }
332
333 return (0);
334}
335

Callers

nothing calls this directly

Calls 4

printHelpFunction · 0.70
printDeviceListFunction · 0.70
runMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected