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>
112 Eigen::Vector4f &origin, Eigen::Quaternionf &orientation,
int &pcd_version,
113 int &data_type,
unsigned int &data_idx);
146 Eigen::Vector4f &origin, Eigen::Quaternionf &orientation,
int &pcd_version,
147 int &data_type,
unsigned int &data_idx,
const int offset = 0);
175 readHeader (
const std::string &file_name,
pcl::PCLPointCloud2 &cloud,
const int offset = 0);
214 int pcd_version,
bool compressed,
unsigned int data_idx);
235 Eigen::Vector4f &origin, Eigen::Quaternionf &orientation,
int &pcd_version,
const int offset = 0);
274 template<
typename Po
intT>
int
280 pcd_version, offset);
288 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
312 map_synchronization_ = sync;
322 const Eigen::Vector4f &origin,
323 const Eigen::Quaternionf &orientation);
336 generateHeaderBinaryCompressed (std::ostream &os,
338 const Eigen::Vector4f &origin,
339 const Eigen::Quaternionf &orientation);
349 const Eigen::Vector4f &origin,
350 const Eigen::Quaternionf &orientation);
359 const Eigen::Vector4f &origin,
360 const Eigen::Quaternionf &orientation);
367 template <
typename Po
intT>
static std::string
369 const int nr_points = std::numeric_limits<int>::max ());
389 const Eigen::Vector4f &origin = Eigen::Vector4f::Zero (),
390 const Eigen::Quaternionf &orientation = Eigen::Quaternionf::Identity (),
391 const int precision = 8);
401 const Eigen::Vector4f &origin = Eigen::Vector4f::Zero (),
402 const Eigen::Quaternionf &orientation = Eigen::Quaternionf::Identity ());
416 const Eigen::Vector4f &origin = Eigen::Vector4f::Zero (),
417 const Eigen::Quaternionf &orientation = Eigen::Quaternionf::Identity ());
431 const Eigen::Vector4f &origin = Eigen::Vector4f::Zero (),
432 const Eigen::Quaternionf &orientation = Eigen::Quaternionf::Identity ());
453 const Eigen::Vector4f &origin = Eigen::Vector4f::Zero (),
454 const Eigen::Quaternionf &orientation = Eigen::Quaternionf::Identity (),
455 const bool binary =
false)
458 return (writeBinary (file_name, cloud, origin, orientation));
460 return (writeASCII (file_name, cloud, origin, orientation, 8));
480 const Eigen::Vector4f &origin = Eigen::Vector4f::Zero (),
481 const Eigen::Quaternionf &orientation = Eigen::Quaternionf::Identity (),
482 const bool binary =
false)
484 return (
write (file_name, *cloud, origin, orientation, binary));
491 template <
typename Po
intT>
int
492 writeBinary (
const std::string &file_name,
503 template <
typename Po
intT>
int
504 writeBinaryCompressed (
const std::string &file_name,
512 template <
typename Po
intT>
int
513 writeBinary (
const std::string &file_name,
515 const std::vector<int> &indices);
522 template <
typename Po
intT>
int
523 writeASCII (
const std::string &file_name,
525 const int precision = 8);
533 template <
typename Po
intT>
int
534 writeASCII (
const std::string &file_name,
536 const std::vector<int> &indices,
537 const int precision = 8);
552 template<
typename Po
intT>
inline int
553 write (
const std::string &file_name,
555 const bool binary =
false)
558 return (writeBinary<PointT> (file_name, cloud));
560 return (writeASCII<PointT> (file_name, cloud));
577 template<
typename Po
intT>
inline int
578 write (
const std::string &file_name,
580 const std::vector<int> &indices,
584 return (writeBinary<PointT> (file_name, cloud, indices));
586 return (writeASCII<PointT> (file_name, cloud, indices));
595 setLockingPermissions (
const std::string &file_name,
596 boost::interprocess::file_lock &lock);
603 resetLockingPermissions (
const std::string &file_name,
604 boost::interprocess::file_lock &lock);
608 bool map_synchronization_;
626 return (p.
read (file_name, cloud));
639 Eigen::Vector4f &origin, Eigen::Quaternionf &orientation)
643 return (p.
read (file_name, cloud, origin, orientation, pcd_version));
651 template<
typename Po
intT>
inline int
655 return (p.
read (file_name, cloud));
675 const Eigen::Vector4f &origin = Eigen::Vector4f::Zero (),
676 const Eigen::Quaternionf &orientation = Eigen::Quaternionf::Identity (),
677 const bool binary_mode =
false)
680 return (w.
write (file_name, cloud, origin, orientation, binary_mode));
697 template<
typename Po
intT>
inline int
701 return (w.
write<
PointT> (file_name, cloud, binary_mode));
720 template<
typename Po
intT>
inline int
724 return (w.
write<
PointT> (file_name, cloud,
false));
736 template<
typename Po
intT>
inline int
760 template<
typename Po
intT>
int
763 const std::vector<int> &indices,
764 const bool binary_mode =
false)
768 return (w.
write<
PointT> (file_name, cloud, indices, binary_mode));
781 template<
typename Po
intT>
inline int
791 #include <pcl/io/impl/pcd_io.hpp>
793 #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.
This file defines compatibility wrappers for low level I/O functions.
~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.