---[ */
| 50 | |
| 51 | /* ---[ */ |
| 52 | int |
| 53 | main (int argc, char** argv) |
| 54 | { |
| 55 | if (argc < 4) |
| 56 | { |
| 57 | std::cerr << "Syntax is: " << argv[0] << " <file_in.pcd> <file_out.pcd> 0/1/2 (ascii/binary/binary_compressed) [precision (ASCII)]" << std::endl; |
| 58 | return (-1); |
| 59 | } |
| 60 | |
| 61 | pcl::PCLPointCloud2 cloud; |
| 62 | Eigen::Vector4f origin; Eigen::Quaternionf orientation; |
| 63 | |
| 64 | if (pcl::io::loadPCDFile (std::string (argv[1]), cloud, origin, orientation) < 0) |
| 65 | { |
| 66 | std::cerr << "Unable to load " << argv[1] << std::endl; |
| 67 | return (-1); |
| 68 | } |
| 69 | |
| 70 | int type = atoi (argv[3]); |
| 71 | |
| 72 | std::cerr << "Loaded a point cloud with " << cloud.width * cloud.height << |
| 73 | " points (total size is " << cloud.data.size () << |
| 74 | ") and the following channels: " << pcl::getFieldsList (cloud) << std::endl; |
| 75 | |
| 76 | pcl::PCDWriter w; |
| 77 | if (type == 0) |
| 78 | { |
| 79 | std::cerr << "Saving file " << argv[2] << " as ASCII." << std::endl; |
| 80 | w.writeASCII (std::string (argv[2]), cloud, origin, orientation, (argc == 5) ? atoi (argv[4]) : 7); |
| 81 | } |
| 82 | else if (type == 1) |
| 83 | { |
| 84 | std::cerr << "Saving file " << argv[2] << " as binary." << std::endl; |
| 85 | w.writeBinary (std::string (argv[2]), cloud, origin, orientation); |
| 86 | } |
| 87 | else if (type == 2) |
| 88 | { |
| 89 | std::cerr << "Saving file " << argv[2] << " as binary_compressed." << std::endl; |
| 90 | w.writeBinaryCompressed (std::string (argv[2]), cloud, origin, orientation); |
| 91 | } |
| 92 | } |
| 93 | /* ]--- */ |
nothing calls this directly
no test coverage detected