Point Cloud Library (PCL)
1.11.1-dev
|
43 #include <pcl/point_cloud.h>
61 out.x = in.x; out.y = in.y; out.z = in.z;
62 out.
intensity = 0.299f *
static_cast <float> (in.r) + 0.587f *
static_cast <float> (in.g) + 0.114f *
static_cast <float> (in.b);
73 out.intensity = 0.299f *
static_cast <float> (in.r) + 0.587f *
static_cast <float> (in.g) + 0.114f *
static_cast <float> (in.b);
84 out.intensity =
static_cast<std::uint8_t
>(0.299f *
static_cast <float> (in.r)
85 + 0.587f *
static_cast <float> (in.g) + 0.114f *
static_cast <float> (in.b));
96 out.intensity =
static_cast<std::uint32_t
>(0.299f *
static_cast <float> (in.r)
97 + 0.587f *
static_cast <float> (in.g) + 0.114f *
static_cast <float> (in.b));
108 const unsigned char max = std::max (in.r, std::max (in.g, in.b));
109 const unsigned char min = std::min (in.r, std::min (in.g, in.b));
111 out.x = in.x; out.y = in.y; out.z = in.z;
112 out.
v =
static_cast <float> (max) / 255.f;
121 const float diff =
static_cast <float> (max - min);
122 out.
s = diff /
static_cast <float> (max);
130 if (max == in.r) out.
h = 60.f * (
static_cast <float> (in.g - in.b) / diff);
131 else if (max == in.g) out.
h = 60.f * (2.f +
static_cast <float> (in.b - in.r) / diff);
132 else out.
h = 60.f * (4.f +
static_cast <float> (in.r - in.g) / diff);
134 if (out.
h < 0.f) out.
h += 360.f;
146 const unsigned char max = std::max (in.r, std::max (in.g, in.b));
147 const unsigned char min = std::min (in.r, std::min (in.g, in.b));
149 out.x = in.x; out.y = in.y; out.z = in.z;
150 out.
v =
static_cast <float> (max) / 255.f;
159 const float diff =
static_cast <float> (max - min);
160 out.
s = diff /
static_cast <float> (max);
168 if (max == in.r) out.
h = 60.f * (
static_cast <float> (in.g - in.b) / diff);
169 else if (max == in.g) out.
h = 60.f * (2.f +
static_cast <float> (in.b - in.r) / diff);
170 else out.
h = 60.f * (4.f +
static_cast <float> (in.r - in.g) / diff);
172 if (out.
h < 0.f) out.
h += 360.f;
183 out.x = in.x; out.y = in.y; out.z = in.z;
186 out.r = out.g = out.b =
static_cast<std::uint8_t
> (255 * in.
v);
190 int i =
static_cast<int> (std::floor (a));
191 float f = a -
static_cast<float> (i);
192 float p = in.
v * (1 - in.
s);
193 float q = in.
v * (1 - in.
s * f);
194 float t = in.
v * (1 - in.
s * (1 - f));
200 out.r =
static_cast<std::uint8_t
> (255 * in.
v);
201 out.g =
static_cast<std::uint8_t
> (255 * t);
202 out.b =
static_cast<std::uint8_t
> (255 * p);
207 out.r =
static_cast<std::uint8_t
> (255 * q);
208 out.g =
static_cast<std::uint8_t
> (255 * in.
v);
209 out.b =
static_cast<std::uint8_t
> (255 * p);
214 out.r =
static_cast<std::uint8_t
> (255 * p);
215 out.g =
static_cast<std::uint8_t
> (255 * in.
v);
216 out.b =
static_cast<std::uint8_t
> (255 * t);
221 out.r =
static_cast<std::uint8_t
> (255 * p);
222 out.g =
static_cast<std::uint8_t
> (255 * q);
223 out.b =
static_cast<std::uint8_t
> (255 * in.
v);
228 out.r =
static_cast<std::uint8_t
> (255 * t);
229 out.g =
static_cast<std::uint8_t
> (255 * p);
230 out.b =
static_cast<std::uint8_t
> (255 * in.
v);
235 out.r =
static_cast<std::uint8_t
> (255 * in.
v);
236 out.g =
static_cast<std::uint8_t
> (255 * p);
237 out.b =
static_cast<std::uint8_t
> (255 * q);
253 for (
const auto &point : in.
points)
271 for (
const auto &point : in.
points)
289 for (
const auto &point : in.
points)
307 for (
const auto &point : in.
points)
325 for (
const auto &point : in.
points)
343 for (
const auto &point : in.
points)
363 float bad_point = std::numeric_limits<float>::quiet_NaN();
364 std::size_t width_ = depth.
width;
365 std::size_t height_ = depth.
height;
366 float constant_ = 1.0f / focal;
368 for (std::size_t v = 0; v < height_; v++)
370 for (std::size_t u = 0; u < width_; u++)
373 float depth_ = depth.
at (u, v).intensity;
377 pt.x = pt.y = pt.z = bad_point;
381 pt.z = depth_ * 0.001f;
382 pt.x =
static_cast<float> (u) * pt.z * constant_;
383 pt.y =
static_cast<float> (v) * pt.z * constant_;
385 pt.r = image.
at (u, v).r;
386 pt.g = image.
at (u, v).g;
387 pt.b = image.
at (u, v).b;
void PointCloudXYZRGBtoXYZHSV(const PointCloud< PointXYZRGB > &in, PointCloud< PointXYZHSV > &out)
Convert a XYZRGB point cloud to a XYZHSV.
void PointXYZRGBtoXYZI(const PointXYZRGB &in, PointXYZI &out)
Convert a XYZRGB point type to a XYZI.
std::uint32_t height
The point cloud height (if organized as an image-structure).
void PointCloudXYZRGBtoXYZI(const PointCloud< PointXYZRGB > &in, PointCloud< PointXYZI > &out)
Convert a XYZRGB point cloud to a XYZI.
std::vector< PointT, Eigen::aligned_allocator< PointT > > points
The point data.
void PointCloudXYZRGBAtoXYZHSV(const PointCloud< PointXYZRGBA > &in, PointCloud< PointXYZHSV > &out)
Convert a XYZRGB point cloud to a XYZHSV.
void PointCloudDepthAndRGBtoXYZRGBA(const PointCloud< Intensity > &depth, const PointCloud< RGB > &image, const float &focal, PointCloud< PointXYZRGBA > &out)
Convert registered Depth image and RGB image to PointCloudXYZRGBA.
void PointRGBtoI(const RGB &in, Intensity &out)
Convert a RGB point type to a I.
A point structure representing the grayscale intensity in single-channel images.
A point structure representing Euclidean xyz coordinates, and the RGB color.
const PointT & at(int column, int row) const
Obtain the point given by the (column, row) coordinates.
void PointXYZRGBtoXYZHSV(const PointXYZRGB &in, PointXYZHSV &out)
Convert a XYZRGB point type to a XYZHSV.
A point structure representing the grayscale intensity in single-channel images.
std::uint32_t width
The point cloud width (if organized as an image-structure).
void PointCloudRGBtoI(const PointCloud< RGB > &in, PointCloud< Intensity > &out)
Convert a RGB point cloud to an Intensity.
A point structure representing Euclidean xyz coordinates, and the RGBA color.
A point structure representing the grayscale intensity in single-channel images.
A structure representing RGB color information.
void PointXYZRGBAtoXYZHSV(const PointXYZRGBA &in, PointXYZHSV &out)
Convert a XYZRGBA point type to a XYZHSV.
void PointXYZHSVtoXYZRGB(const PointXYZHSV &in, PointXYZRGB &out)
void push_back(const PointT &pt)
Insert a new point in the cloud, at the end of the container.