40 #ifndef PCL_IO_PNG_IO_H_
41 #define PCL_IO_PNG_IO_H_
43 #include <pcl/pcl_macros.h>
44 #include <pcl/point_cloud.h>
45 #include <pcl/point_types.h>
62 saveCharPNGFile (
const std::string& file_name,
const unsigned char *mono_image,
int width,
int height,
int channels);
73 saveShortPNGFile (
const std::string& file_name,
const unsigned short *short_image,
int width,
int height,
int channels);
83 saveRgbPNGFile (
const std::string& file_name,
const unsigned char *rgb_image,
int width,
int height)
116 template <
typename T>
void
119 std::vector<unsigned char> data(cloud.
width * cloud.
height * 3);
121 for (
size_t i = 0; i < cloud.
points.size (); ++i)
123 data[i*3 + 0] = cloud.
points[i].r;
124 data[i*3 + 1] = cloud.
points[i].g;
125 data[i*3 + 2] = cloud.
points[i].b;
139 std::vector<unsigned short> data(cloud.
width * cloud.
height);
141 for (
size_t i = 0; i < cloud.
points.size (); ++i)
143 data[i] =
static_cast<unsigned short> (cloud.
points[i].label);
150 #endif //#ifndef PCL_IO_PNG_IO_H_
PCL_EXPORTS void saveCharPNGFile(const std::string &file_name, const unsigned char *mono_image, int width, int height, int channels)
Saves 8-bit encoded image to PNG file.
PCL_EXPORTS void saveShortPNGFile(const std::string &file_name, const unsigned short *short_image, int width, int height, int channels)
Saves 16-bit encoded image to PNG file.
uint32_t width
The point cloud width (if organized as an image-structure).
std::vector< PointT, Eigen::aligned_allocator< PointT > > points
The point data.
void savePNGFile(const std::string &file_name, const pcl::PointCloud< unsigned char > &cloud)
Saves 8-bit grayscale cloud as image to PNG file.
PointCloud represents the base class in PCL for storing collections of 3D points. ...
PCL_EXPORTS void saveRgbPNGFile(const std::string &file_name, const unsigned char *rgb_image, int width, int height)
Saves 8-bit encoded RGB image to PNG file.
uint32_t height
The point cloud height (if organized as an image-structure).