---[ */
| 201 | |
| 202 | /* ---[ */ |
| 203 | int |
| 204 | main (int argc, char** argv) |
| 205 | { |
| 206 | print_info ("Train unary classifier using FPFH. For more information, use: %s -h\n", argv[0]); |
| 207 | |
| 208 | if (argc < 3) |
| 209 | { |
| 210 | printHelp (argc, argv); |
| 211 | return (-1); |
| 212 | } |
| 213 | |
| 214 | bool label = (find_argument (argc, argv, "-label") != -1); |
| 215 | |
| 216 | // Parse the command line arguments for .pcd files |
| 217 | std::vector<int> p_file_indices; |
| 218 | p_file_indices = parse_file_extension_argument (argc, argv, ".pcd"); |
| 219 | if (!label) |
| 220 | { |
| 221 | if (p_file_indices.size () != 2) |
| 222 | { |
| 223 | print_error ("Need one input PCD file and one output PCD file to continue.\n"); |
| 224 | return (-1); |
| 225 | } |
| 226 | } |
| 227 | else |
| 228 | { |
| 229 | if (p_file_indices.size () != 1) |
| 230 | { |
| 231 | print_error ("Need one input PCD file and one output file name to continue.\n"); |
| 232 | return (-1); |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | // parse optional input arguments from the command line |
| 237 | unsigned int k = default_cluster_size; |
| 238 | float normal_radius_search = static_cast<float> (default_normal_radius_search); |
| 239 | float fpfh_radius_search = static_cast<float> (default_fpfh_radius_search); |
| 240 | |
| 241 | parse_argument (argc, argv, "-k", k); |
| 242 | parse_argument (argc, argv, "-normal-radius-search", normal_radius_search); |
| 243 | parse_argument (argc, argv, "-fpfh-radius-search", fpfh_radius_search); |
| 244 | |
| 245 | print_info ("\nlabel: %d \n", label); |
| 246 | print_info ("k-means cluster size: %d \n", k); |
| 247 | print_info ("normal-radius-search: %f \n", normal_radius_search); |
| 248 | print_info ("fpfh-radius-search: %f \n\n", fpfh_radius_search); |
| 249 | |
| 250 | std::vector<FeatureT, Eigen::aligned_allocator<FeatureT> > features; |
| 251 | //FeatureT::Ptr feature (new FeatureT); |
| 252 | if (!label) |
| 253 | { |
| 254 | // Load the input file |
| 255 | CloudT::Ptr cloud (new CloudT); |
| 256 | if (!loadCloud (argv[p_file_indices[0]], cloud)) |
| 257 | return (-1); |
| 258 | |
| 259 | // compute the features |
| 260 | compute (cloud, features, k, normal_radius_search, fpfh_radius_search, label); |