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> 46 #include <pcl/console/print.h> 49 #include <pcl/io/point_cloud_image_extractors.h> 64 saveCharPNGFile (
const std::string& file_name,
const unsigned char *mono_image,
int width,
int height,
int channels);
75 saveShortPNGFile (
const std::string& file_name,
const unsigned short *short_image,
int width,
int height,
int channels);
85 saveRgbPNGFile (
const std::string& file_name,
const unsigned char *rgb_image,
int width,
int height);
117 template <
typename T>
119 "pcl::io::savePNGFile<typename T> (file_name, cloud) is deprecated, please use a new generic " 120 "function pcl::io::savePNGFile (file_name, cloud, field_name) with \"rgb\" as the field name." 125 std::vector<unsigned char> data(cloud.width * cloud.height * 3);
127 for (
size_t i = 0; i < cloud.points.size (); ++i)
129 data[i*3 + 0] = cloud.points[i].r;
130 data[i*3 + 1] = cloud.points[i].g;
131 data[i*3 + 2] = cloud.points[i].b;
142 PCL_EXPORTS PCL_DEPRECATED (
143 "savePNGFile (file_name, cloud) is deprecated, please use a new generic function " 144 "savePNGFile (file_name, cloud, field_name) with \"label\" as the field name." 155 template <
typename Po
intT>
void 159 PointCloudImageExtractorPtr pcie;
160 if (field_name ==
"normal")
164 else if (field_name ==
"rgb")
168 else if (field_name ==
"label")
172 else if (field_name ==
"z")
176 else if (field_name ==
"curvature")
180 else if (field_name ==
"intensity")
186 PCL_ERROR (
"[pcl::io::savePNGFile] Unsupported field \"%s\".\n", field_name.c_str ());
190 if (pcie->extract (cloud, image))
196 PCL_ERROR (
"[pcl::io::savePNGFile] Failed to extract an image from \"%s\" field.\n", field_name.c_str());
203 #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.
Defines all the PCL implemented PointT point type structures.
PCL_EXPORTS void savePNGFile(const std::string &file_name, const pcl::PointCloud< unsigned char > &cloud)
Saves 8-bit grayscale cloud as image to PNG file.
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.