---[ */
| 164 | |
| 165 | /* ---[ */ |
| 166 | int |
| 167 | main (int argc, char** argv) |
| 168 | { |
| 169 | print_info ("Filter a point cloud using the pcl::morphologicalOpen. For more information, use: %s -h\n", argv[0]); |
| 170 | |
| 171 | if (argc < 3) |
| 172 | { |
| 173 | printHelp (argc, argv); |
| 174 | return (-1); |
| 175 | } |
| 176 | |
| 177 | bool batch_mode = false; |
| 178 | |
| 179 | // Command line parsing |
| 180 | std::string method = default_method; |
| 181 | float resolution = default_resolution; |
| 182 | parse_argument (argc, argv, "-method", method); |
| 183 | parse_argument (argc, argv, "-resolution", resolution); |
| 184 | std::string input_dir, output_dir; |
| 185 | if (parse_argument (argc, argv, "-input_dir", input_dir) != -1) |
| 186 | { |
| 187 | PCL_INFO ("Input directory given as %s. Batch process mode on.\n", input_dir.c_str ()); |
| 188 | if (parse_argument (argc, argv, "-output_dir", output_dir) == -1) |
| 189 | { |
| 190 | PCL_ERROR ("Need an output directory! Please use -output_dir to continue.\n"); |
| 191 | return (-1); |
| 192 | } |
| 193 | |
| 194 | // Both input dir and output dir given, switch into batch processing mode |
| 195 | batch_mode = true; |
| 196 | } |
| 197 | |
| 198 | if (!batch_mode) |
| 199 | { |
| 200 | // Parse the command line arguments for .pcd files |
| 201 | std::vector<int> p_file_indices; |
| 202 | p_file_indices = parse_file_extension_argument (argc, argv, ".pcd"); |
| 203 | if (p_file_indices.size () != 2) |
| 204 | { |
| 205 | print_error ("Need one input PCD file and one output PCD file to continue.\n"); |
| 206 | return (-1); |
| 207 | } |
| 208 | |
| 209 | // Load the first file |
| 210 | Cloud::Ptr cloud (new Cloud); |
| 211 | if (!loadCloud (argv[p_file_indices[0]], *cloud)) |
| 212 | return (-1); |
| 213 | |
| 214 | // Perform the feature estimation |
| 215 | Cloud output; |
| 216 | compute (cloud, output, resolution, method); |
| 217 | |
| 218 | // Save into the second file |
| 219 | saveCloud (argv[p_file_indices[1]], output); |
| 220 | } |
| 221 | else |
| 222 | { |
| 223 | if (!input_dir.empty() && pcl_fs::exists (input_dir)) |
nothing calls this directly
no test coverage detected