///////////////////////////////////////////////////////////////////////////////////
| 1204 | |
| 1205 | //////////////////////////////////////////////////////////////////////////////////////// |
| 1206 | int |
| 1207 | pcl::PLYWriter::writeBinary (const std::string& file_name, |
| 1208 | const pcl::PCLPointCloud2& cloud, |
| 1209 | const Eigen::Vector4f& origin, |
| 1210 | const Eigen::Quaternionf& orientation, |
| 1211 | bool use_camera) |
| 1212 | { |
| 1213 | if (cloud.data.empty ()) |
| 1214 | { |
| 1215 | PCL_ERROR ("[pcl::PLYWriter::writeBinary] Input point cloud has no data!\n"); |
| 1216 | return (-1); |
| 1217 | } |
| 1218 | |
| 1219 | std::ofstream fs; |
| 1220 | fs.open (file_name.c_str (), |
| 1221 | std::ios::out | std::ios::binary | |
| 1222 | std::ios::trunc); // Open file in binary mode and erase current contents |
| 1223 | // if any |
| 1224 | if (!fs) |
| 1225 | { |
| 1226 | PCL_ERROR ("[pcl::PLYWriter::writeBinary] Error during opening (%s)!\n", |
| 1227 | file_name.c_str ()); |
| 1228 | return (-1); |
| 1229 | } |
| 1230 | |
| 1231 | if (!(writeBinary (fs, cloud, origin, orientation, use_camera) == 0)) |
| 1232 | { |
| 1233 | fs.close(); |
| 1234 | return -1; |
| 1235 | } |
| 1236 | fs.close(); |
| 1237 | return 0; |
| 1238 | } |
| 1239 | |
| 1240 | int |
| 1241 | pcl::PLYWriter::writeBinary (std::ostream& os, |