00001 #include "openni_capture.h" 00002 00003 #include <string> 00004 #include <pcl/console/parse.h> 00005 00006 int 00007 main (int argc, char ** argv) 00008 { 00009 if (argc < 2) 00010 { 00011 pcl::console::print_info ("Syntax is: %s output_filename <options>\n", argv[0]); 00012 pcl::console::print_info (" where options are:\n"); 00013 pcl::console::print_info (" -n nr_frames ... Number of frames to capture (default = 1)\n"); 00014 pcl::console::print_info (" Note: The output filename should be provided without the .pcd extension.\n"); 00015 pcl::console::print_info (" File names will have frame numbers and extension appended to them.\n"); 00016 pcl::console::print_info (" (e.g., 'output' will become 'output_1.pcd', 'output_2.pcd', etc.)\n"); 00017 return (1); 00018 } 00019 00020 // Determine the number of frames to capture 00021 int nr_frames = 1; // Default value 00022 pcl::console::parse_argument (argc, argv, "-n", nr_frames); 00023 00024 OpenNICapture camera; 00025 camera.setTriggerMode (true); 00026 for (int i = 0; i < nr_frames; ++i) 00027 { 00028 std::string foo = argv[1]; 00029 std::stringstream filename (foo); 00030 filename << argv[1] << "_" << i << ".pcd"; 00031 PCL_INFO ("%s\n", filename.str().c_str()); 00032 camera.snapAndSave (filename.str ()); 00033 } 00034 00035 return (0); 00036 }