| 121 | } |
| 122 | |
| 123 | void |
| 124 | saveCloud (const std::string &filename, const pcl::PCLPointCloud2 &output) |
| 125 | { |
| 126 | TicToc tt; |
| 127 | tt.tic (); |
| 128 | |
| 129 | print_highlight ("Saving "); print_value ("%s ", filename.c_str ()); |
| 130 | |
| 131 | PCDWriter w_pcd; |
| 132 | PLYWriter w_ply; |
| 133 | std::string output_ext = pcl_fs::path (filename).extension ().string (); |
| 134 | std::transform (output_ext.begin (), output_ext.end (), output_ext.begin (), ::tolower); |
| 135 | |
| 136 | if (output_ext == ".pcd") |
| 137 | { |
| 138 | w_pcd.writeBinaryCompressed (filename, output); |
| 139 | } |
| 140 | else if (output_ext == ".ply") |
| 141 | { |
| 142 | w_ply.writeBinary (filename, output); |
| 143 | } |
| 144 | else if (output_ext == ".vtk") |
| 145 | { |
| 146 | w_ply.writeBinary (filename, output); |
| 147 | } |
| 148 | |
| 149 | print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms : "); print_value ("%d", output.width * output.height); print_info (" points]\n"); |
| 150 | } |
| 151 | |
| 152 | /* ---[ */ |
| 153 | int |
no test coverage detected