40 #ifndef PCL_IO_PCD_IO_H_
41 #define PCL_IO_PCD_IO_H_
43 #include <pcl/point_cloud.h>
44 #include <pcl/io/file_io.h>
116 Eigen::Vector4f &origin, Eigen::Quaternionf &orientation,
int &pcd_version,
117 int &data_type,
unsigned int &data_idx,
const int offset = 0);
143 readHeader (
const std::string &file_name,
pcl::PCLPointCloud2 &cloud,
const int offset = 0);
164 Eigen::Vector4f &origin, Eigen::Quaternionf &orientation,
int &pcd_version,
const int offset = 0);
203 template<
typename Po
intT>
int
209 pcd_version, offset);
217 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
241 map_synchronization_ = sync;
251 const Eigen::Vector4f &origin,
252 const Eigen::Quaternionf &orientation);
261 const Eigen::Vector4f &origin,
262 const Eigen::Quaternionf &orientation);
271 const Eigen::Vector4f &origin,
272 const Eigen::Quaternionf &orientation);
279 template <
typename Po
intT>
static std::string
281 const int nr_points = std::numeric_limits<int>::max ());
301 const Eigen::Vector4f &origin = Eigen::Vector4f::Zero (),
302 const Eigen::Quaternionf &orientation = Eigen::Quaternionf::Identity (),
303 const int precision = 8);
313 const Eigen::Vector4f &origin = Eigen::Vector4f::Zero (),
314 const Eigen::Quaternionf &orientation = Eigen::Quaternionf::Identity ());
324 const Eigen::Vector4f &origin = Eigen::Vector4f::Zero (),
325 const Eigen::Quaternionf &orientation = Eigen::Quaternionf::Identity ());
346 const Eigen::Vector4f &origin = Eigen::Vector4f::Zero (),
347 const Eigen::Quaternionf &orientation = Eigen::Quaternionf::Identity (),
348 const bool binary =
false)
351 return (writeBinary (file_name, cloud, origin, orientation));
353 return (writeASCII (file_name, cloud, origin, orientation, 8));
373 const Eigen::Vector4f &origin = Eigen::Vector4f::Zero (),
374 const Eigen::Quaternionf &orientation = Eigen::Quaternionf::Identity (),
375 const bool binary =
false)
377 return (
write (file_name, *cloud, origin, orientation, binary));
384 template <
typename Po
intT>
int
385 writeBinary (
const std::string &file_name,
392 template <
typename Po
intT>
int
393 writeBinaryCompressed (
const std::string &file_name,
401 template <
typename Po
intT>
int
402 writeBinary (
const std::string &file_name,
404 const std::vector<int> &indices);
411 template <
typename Po
intT>
int
412 writeASCII (
const std::string &file_name,
414 const int precision = 8);
422 template <
typename Po
intT>
int
423 writeASCII (
const std::string &file_name,
425 const std::vector<int> &indices,
426 const int precision = 8);
441 template<
typename Po
intT>
inline int
442 write (
const std::string &file_name,
444 const bool binary =
false)
447 return (writeBinary<PointT> (file_name, cloud));
449 return (writeASCII<PointT> (file_name, cloud));
466 template<
typename Po
intT>
inline int
467 write (
const std::string &file_name,
469 const std::vector<int> &indices,
473 return (writeBinary<PointT> (file_name, cloud, indices));
475 return (writeASCII<PointT> (file_name, cloud, indices));
484 setLockingPermissions (
const std::string &file_name,
485 boost::interprocess::file_lock &lock);
492 resetLockingPermissions (
const std::string &file_name,
493 boost::interprocess::file_lock &lock);
497 bool map_synchronization_;
515 return (p.
read (file_name, cloud));
528 Eigen::Vector4f &origin, Eigen::Quaternionf &orientation)
532 return (p.
read (file_name, cloud, origin, orientation, pcd_version));
540 template<
typename Po
intT>
inline int
544 return (p.
read (file_name, cloud));
564 const Eigen::Vector4f &origin = Eigen::Vector4f::Zero (),
565 const Eigen::Quaternionf &orientation = Eigen::Quaternionf::Identity (),
566 const bool binary_mode =
false)
569 return (w.
write (file_name, cloud, origin, orientation, binary_mode));
586 template<
typename Po
intT>
inline int
590 return (w.
write<
PointT> (file_name, cloud, binary_mode));
609 template<
typename Po
intT>
inline int
613 return (w.
write<
PointT> (file_name, cloud,
false));
625 template<
typename Po
intT>
inline int
649 template<
typename Po
intT>
int
652 const std::vector<int> &indices,
653 const bool binary_mode =
false)
657 return (w.
write<
PointT> (file_name, cloud, indices, binary_mode));
670 template<
typename Po
intT>
inline int
680 #include <pcl/io/impl/pcd_io.hpp>
682 #endif //#ifndef PCL_IO_PCD_IO_H_
void fromPCLPointCloud2(const pcl::PCLPointCloud2 &msg, pcl::PointCloud< PointT > &cloud, const MsgFieldMap &field_map)
Convert a PCLPointCloud2 binary data blob into a pcl::PointCloud object using a field_map...
int write(const std::string &file_name, const pcl::PCLPointCloud2::ConstPtr &cloud, const Eigen::Vector4f &origin=Eigen::Vector4f::Zero(), const Eigen::Quaternionf &orientation=Eigen::Quaternionf::Identity(), const bool binary=false)
Save point cloud data to a PCD file containing n-D points.
int writeBinaryCompressed(const std::string &file_name, const pcl::PCLPointCloud2 &cloud, const Eigen::Vector4f &origin=Eigen::Vector4f::Zero(), const Eigen::Quaternionf &orientation=Eigen::Quaternionf::Identity())
Save point cloud data to a PCD file containing n-D points, in BINARY_COMPRESSED format.
~PCDReader()
Empty destructor.
int savePCDFileASCII(const std::string &file_name, const pcl::PointCloud< PointT > &cloud)
Templated version for saving point cloud data to a PCD file containing a specific given cloud format...
void read(std::istream &stream, Type &value)
Function for reading data from a stream.
Point Cloud Data (FILE) file format writer.
void setMapSynchronization(bool sync)
Set whether mmap() synchornization via msync() is desired before munmap() calls.
int savePCDFile(const std::string &file_name, const pcl::PCLPointCloud2 &cloud, const Eigen::Vector4f &origin=Eigen::Vector4f::Zero(), const Eigen::Quaternionf &orientation=Eigen::Quaternionf::Identity(), const bool binary_mode=false)
Save point cloud data to a PCD file containing n-D points.
Point Cloud Data (FILE) file format reader interface.
Eigen::Quaternionf sensor_orientation_
Sensor acquisition pose (rotation).
int savePCDFileBinary(const std::string &file_name, const pcl::PointCloud< PointT > &cloud)
Templated version for saving point cloud data to a PCD file containing a specific given cloud format...
boost::shared_ptr< ::pcl::PCLPointCloud2 const > ConstPtr
int write(const std::string &file_name, const pcl::PCLPointCloud2 &cloud, const Eigen::Vector4f &origin=Eigen::Vector4f::Zero(), const Eigen::Quaternionf &orientation=Eigen::Quaternionf::Identity(), const bool binary=false)
Save point cloud data to a PCD file containing n-D points.
PCDReader()
Empty constructor.
PointCloud represents the base class in PCL for storing collections of 3D points. ...
int loadPCDFile(const std::string &file_name, pcl::PCLPointCloud2 &cloud)
Load a PCD v.6 file into a templated PointCloud type.
int write(const std::string &file_name, const pcl::PointCloud< PointT > &cloud, const std::vector< int > &indices, bool binary=false)
Save point cloud data to a PCD file containing n-D points.
int write(const std::string &file_name, const pcl::PointCloud< PointT > &cloud, const bool binary=false)
Save point cloud data to a PCD file containing n-D points.
Eigen::Vector4f sensor_origin_
Sensor acquisition pose (origin/translation).
void write(std::ostream &stream, Type value)
Function for writing data to a stream.
int read(const std::string &file_name, pcl::PointCloud< PointT > &cloud, const int offset=0)
Read a point cloud data from any PCD file, and convert it to the given template format.
Point Cloud Data (PCD) file format reader.
A point structure representing Euclidean xyz coordinates, and the RGB color.
Point Cloud Data (PCD) file format writer.
int savePCDFileBinaryCompressed(const std::string &file_name, const pcl::PointCloud< PointT > &cloud)
Templated version for saving point cloud data to a PCD file containing a specific given cloud format...
int read(const std::string &file_name, pcl::PCLPointCloud2 &cloud, Eigen::Vector4f &origin, Eigen::Quaternionf &orientation, int &pcd_version, const int offset=0)
Read a point cloud data from a PCD file and store it into a pcl/PCLPointCloud2.