---[ */
| 660 | |
| 661 | /* ---[ */ |
| 662 | int |
| 663 | main(int argc, char** argv) |
| 664 | { |
| 665 | // Parse the command line arguments for .pcd files |
| 666 | std::vector<int> p_file_indices; |
| 667 | p_file_indices = parse_file_extension_argument(argc, argv, ".pcd"); |
| 668 | if (p_file_indices.empty()) { |
| 669 | print_error(" Need at least an input PCD file (e.g. scene.pcd) to continue!\n\n"); |
| 670 | print_info("Ideally, need an input file, and three output PCD files, e.g., " |
| 671 | "object.pcd, plane.pcd, rest.pcd\n"); |
| 672 | return -1; |
| 673 | } |
| 674 | |
| 675 | std::string object_file = "object.pcd"; |
| 676 | std::string plane_file = "plane.pcd"; |
| 677 | if (p_file_indices.size() >= 3) |
| 678 | plane_file = argv[p_file_indices[2]]; |
| 679 | if (p_file_indices.size() >= 2) |
| 680 | object_file = argv[p_file_indices[1]]; |
| 681 | |
| 682 | PCDReader reader; |
| 683 | // Test the header |
| 684 | pcl::PCLPointCloud2 dummy; |
| 685 | reader.readHeader(argv[p_file_indices[0]], dummy); |
| 686 | if (dummy.height != 1 && getFieldIndex(dummy, "rgba") != -1) { |
| 687 | print_highlight("Enabling 2D image viewer mode.\n"); |
| 688 | ObjectSelection<PointXYZRGBA> s; |
| 689 | if (!s.load(argv[p_file_indices[0]])) |
| 690 | return -1; |
| 691 | s.initGUI(); |
| 692 | s.compute(); |
| 693 | s.save(object_file, plane_file); |
| 694 | } |
| 695 | else { |
| 696 | ObjectSelection<PointXYZ> s; |
| 697 | if (!s.load(argv[p_file_indices[0]])) |
| 698 | return -1; |
| 699 | s.initGUI(); |
| 700 | s.compute(); |
| 701 | s.save(object_file, plane_file); |
| 702 | } |
| 703 | |
| 704 | return 0; |
| 705 | } |
| 706 | /* ]--- */ |
nothing calls this directly
no test coverage detected