39 #ifndef PCL_TYPE_CONVERSIONS_H 40 #define PCL_TYPE_CONVERSIONS_H 59 out.x = in.x; out.y = in.y; out.z = in.z;
60 out.intensity = 0.299f * static_cast <
float> (in.r) + 0.587
f * static_cast <float> (in.g) + 0.114f * static_cast <
float> (in.b);
71 out.intensity = 0.299f * static_cast <
float> (in.r) + 0.587
f * static_cast <float> (in.g) + 0.114f * static_cast <
float> (in.b);
83 + 0.587
f * static_cast <float> (in.g) + 0.114f * static_cast <
float> (in.b));
95 + 0.587f * static_cast <
float> (in.g) + 0.114
f * static_cast <float> (in.b));
109 out.v = static_cast <
float> (
max) / 255.
f;
118 const float diff = static_cast <
float> (max -
min);
119 out.s = diff / static_cast <
float> (
max);
127 if (max == in.r) out.h = 60.f * ( static_cast <
float> (in.g - in.b) / diff);
128 else if (max == in.g) out.h = 60.f * (2.f + static_cast <
float> (in.b - in.r) / diff);
129 else out.h = 60.f * (4.f + static_cast <
float> (in.r - in.g) / diff);
131 if (out.h < 0.f) out.h += 360.f;
146 out.v = static_cast <
float> (
max) / 255.
f;
155 const float diff = static_cast <
float> (max -
min);
156 out.s = diff / static_cast <
float> (
max);
164 if (max == in.r) out.h = 60.f * ( static_cast <
float> (in.g - in.b) / diff);
165 else if (max == in.g) out.h = 60.f * (2.f + static_cast <
float> (in.b - in.r) / diff);
166 else out.h = 60.f * (4.f + static_cast <
float> (in.r - in.g) / diff);
168 if (out.h < 0.f) out.h += 360.f;
179 out.x = in.x; out.y = in.y; out.z = in.z;
182 out.r = out.g = out.b =
static_cast<uint8_t
> (in.v);
186 int i =
static_cast<int> (floorf (a));
187 float f = a -
static_cast<float> (i);
188 float p = in.v * (1 - in.s);
189 float q = in.v * (1 - in.s *
f);
190 float t = in.v * (1 - in.s * (1 -
f));
196 out.r =
static_cast<uint8_t
> (255 * in.v);
197 out.g =
static_cast<uint8_t
> (255 * t);
198 out.b =
static_cast<uint8_t
> (255 * p);
203 out.r =
static_cast<uint8_t
> (255 * q);
204 out.g =
static_cast<uint8_t
> (255 * in.v);
205 out.b =
static_cast<uint8_t
> (255 * p);
210 out.r =
static_cast<uint8_t
> (255 * p);
211 out.g =
static_cast<uint8_t
> (255 * in.v);
212 out.b =
static_cast<uint8_t
> (255 * t);
217 out.r =
static_cast<uint8_t
> (255 * p);
218 out.g =
static_cast<uint8_t
> (255 * q);
219 out.b =
static_cast<uint8_t
> (255 * in.v);
224 out.r =
static_cast<uint8_t
> (255 * t);
225 out.g =
static_cast<uint8_t
> (255 * p);
226 out.b =
static_cast<uint8_t
> (255 * in.v);
231 out.r =
static_cast<uint8_t
> (255 * in.v);
232 out.g =
static_cast<uint8_t
> (255 * p);
233 out.b =
static_cast<uint8_t
> (255 * q);
247 out.width = in.width;
248 out.height = in.height;
249 for (
size_t i = 0; i < in.points.size (); i++)
253 out.points.push_back (p);
265 out.width = in.width;
266 out.height = in.height;
267 for (
size_t i = 0; i < in.points.size (); i++)
271 out.points.push_back (p);
283 out.width = in.width;
284 out.height = in.height;
285 for (
size_t i = 0; i < in.points.size (); i++)
289 out.points.push_back (p);
301 out.width = in.width;
302 out.height = in.height;
303 for (
size_t i = 0; i < in.points.size (); i++)
307 out.points.push_back (p);
319 out.width = in.width;
320 out.height = in.height;
321 for (
size_t i = 0; i < in.points.size (); i++)
325 out.points.push_back (p);
337 out.width = in.width;
338 out.height = in.height;
339 for (
size_t i = 0; i < in.points.size (); i++)
343 out.points.push_back (p);
359 float bad_point = std::numeric_limits<float>::quiet_NaN();
360 int width_ = depth.width;
361 int height_ = depth.height;
362 float constant_ = 1.0f / focal;
364 for(
unsigned int v = 0;
v < height_;
v++)
366 for(
unsigned int u = 0; u < width_; u++)
370 float depth_ = depth.at(u,
v).intensity;
374 pt.x = pt.y = pt.z = bad_point;
378 pt.z = depth_ * 0.001f;
379 pt.x =
static_cast<float> (u) * pt.z * constant_;
380 pt.y = static_cast<float> (
v) * pt.z * constant_;
382 pt.r = image.at(u,
v).r;
383 pt.g = image.at(u,
v).g;
384 pt.b = image.at(u,
v).b;
386 out.points.push_back(pt);
390 out.height = height_;
394 #endif //#ifndef PCL_TYPE_CONVERSIONS_H void PointCloudDepthAndRGBtoXYZRGBA(PointCloud< Intensity > &depth, PointCloud< RGB > &image, float &focal, PointCloud< PointXYZRGBA > &out)
Convert registered Depth image and RGB image to PointCloudXYZRGBA.
double min(const OneDataStat &d)
wrapper function for min method for boost::function
void PointXYZRGBAtoXYZHSV(PointXYZRGBA &in, PointXYZHSV &out)
Convert a XYZRGB point type to a XYZHSV.
void PointCloudXYZRGBtoXYZI(PointCloud< PointXYZRGB > &in, PointCloud< PointXYZI > &out)
Convert a XYZRGB point cloud to a XYZI.
double max(const OneDataStat &d)
wrapper function for max method for boost::function
void PointRGBtoI(RGB &in, Intensity &out)
Convert a RGB point type to a I.
IMETHOD Vector diff(const Vector &p_w_a, const Vector &p_w_b, double dt=1)
void PointCloudXYZRGBAtoXYZHSV(PointCloud< PointXYZRGBA > &in, PointCloud< PointXYZHSV > &out)
Convert a XYZRGB point cloud to a XYZHSV.
void PointXYZRGBtoXYZI(PointXYZRGB &in, PointXYZI &out)
Convert a XYZRGB point type to a XYZI.
void PointCloudRGBtoI(PointCloud< RGB > &in, PointCloud< Intensity > &out)
Convert a RGB point cloud to a Intensity.
sensor_msgs::PointCloud2 PointCloud
void PointXYZRGBtoXYZHSV(PointXYZRGB &in, PointXYZHSV &out)
Convert a XYZRGB point type to a XYZHSV.
void PointXYZHSVtoXYZRGB(PointXYZHSV &in, PointXYZRGB &out)
void PointCloudXYZRGBtoXYZHSV(PointCloud< PointXYZRGB > &in, PointCloud< PointXYZHSV > &out)
Convert a XYZRGB point cloud to a XYZHSV.