Go to the documentation of this file.00001
00063 #ifndef COB_3D_MAPPING_COMMON_IO_H_
00064 #define COB_3D_MAPPING_COMMON_IO_H_
00065
00066 #include <pcl/point_types.h>
00067 #include <pcl/point_cloud.h>
00068
00069 #include <float.h>
00070 #include <iomanip>
00071
00072 namespace cob_3d_mapping_common
00073 {
00076 class PPMReader
00077 {
00078 public:
00080 PPMReader() { }
00082 ~PPMReader() { }
00083
00090 int mapLabels (const std::string &file_name, pcl::PointCloud<pcl::PointXYZRGB>& cloud, bool remove_undef_points=false);
00091 int mapRGB(const std::string &file_name, pcl::PointCloud<pcl::PointXYZRGB>& cloud, bool remove_undef_points=false);
00092 };
00093
00096 class PPMWriter
00097 {
00098 public:
00100 PPMWriter()
00101 : fixed_max_(false), fixed_min_(false), max_z_(FLT_MIN), min_z_(FLT_MAX)
00102 { }
00104 ~PPMWriter() { }
00105
00112 int writeRGB (const std::string &file_name, const pcl::PointCloud<pcl::PointXYZRGB> &cloud);
00113
00126 int writeDepth (const std::string &file_name, const pcl::PointCloud<pcl::PointXYZRGB> &cloud);
00127
00128 int writeDepthLinear (const std::string &file_name, const pcl::PointCloud<pcl::PointXYZRGB> &cloud);
00129
00134 void setMaxZ (const float &max);
00139 void setMinZ (const float &min);
00140
00142 bool fixed_max_;
00144 bool fixed_min_;
00146 float max_z_;
00148 float min_z_;
00149 };
00150
00161 uint32_t getGradientColor(double position, uint8_t rgb[]);
00162
00170 std::string colorHumanReadable(int id)
00171 {
00172 std::stringstream ss;
00173 ss << "0x" << std::setfill('0') << std::setw(6) << std::right << std::hex << id << std::dec;
00174 return ss.str();
00175 }
00176 }
00177
00178 #endif // #ifndef COB_3D_MAPPING_COMMON_IO_H_