11 #include <mrpt/config.h> 18 #include <pcl/point_cloud.h> 19 #include <pcl/point_types.h> 30 pcl::PointCloud<pcl::PointXYZ>&
m_obj;
36 static constexpr
bool HAS_RGB =
false;
38 static constexpr
bool HAS_RGBf =
false;
40 static constexpr
bool HAS_RGBu8 =
false;
44 : m_obj(*const_cast<pcl::PointCloud<pcl::PointXYZ>*>(&obj))
48 inline size_t size()
const {
return m_obj.points.size(); }
50 inline void resize(
const size_t N) { m_obj.points.resize(N); }
54 m_obj.height = height;
59 inline void getPointXYZ(
const size_t idx, T& x, T& y, T& z)
const 61 const pcl::PointXYZ& p = m_obj.points[idx];
70 pcl::PointXYZ& p = m_obj.points[idx];
79 pcl::PointXYZ& p = m_obj.points[idx];
80 p.x = p.y = p.z = std::numeric_limits<float>::quiet_NaN();
91 pcl::PointCloud<pcl::PointXYZRGB>&
m_obj;
97 static constexpr
bool HAS_RGB =
true;
99 static constexpr
bool HAS_RGBf =
false;
101 static constexpr
bool HAS_RGBu8 =
true;
105 : m_obj(*const_cast<pcl::PointCloud<pcl::PointXYZRGB>*>(&obj))
109 inline size_t size()
const {
return m_obj.points.size(); }
111 inline void resize(
const size_t N) { m_obj.points.resize(N); }
115 m_obj.height = height;
120 template <
typename T>
123 const pcl::PointXYZRGB& p = m_obj.points[idx];
132 pcl::PointXYZRGB& p = m_obj.points[idx];
136 p.r = p.g = p.b = 255;
140 template <
typename T>
142 const size_t idx, T& x, T& y, T& z,
float& r,
float& g,
float& b)
const 144 const pcl::PointXYZRGB& p = m_obj.points[idx];
155 const float r,
const float g,
const float b)
157 pcl::PointXYZRGB& p = m_obj.points[idx];
167 template <
typename T>
169 const size_t idx, T& x, T& y, T& z, uint8_t& r, uint8_t& g,
172 const pcl::PointXYZRGB& p = m_obj.points[idx];
183 const uint8_t r,
const uint8_t g,
const uint8_t b)
185 pcl::PointXYZRGB& p = m_obj.points[idx];
196 const size_t idx,
float& r,
float& g,
float& b)
const 198 const pcl::PointXYZRGB& p = m_obj.points[idx];
205 const size_t idx,
const float r,
const float g,
const float b)
207 pcl::PointXYZRGB& p = m_obj.points[idx];
215 const size_t idx, uint8_t& r, uint8_t& g, uint8_t& b)
const 217 const pcl::PointXYZRGB& p = m_obj.points[idx];
224 const size_t idx,
const uint8_t r,
const uint8_t g,
const uint8_t b)
226 pcl::PointXYZRGB& p = m_obj.points[idx];
242 pcl::PointCloud<pcl::PointXYZRGBA>&
m_obj;
248 static constexpr
bool HAS_RGB =
true;
250 static constexpr
bool HAS_RGBf =
false;
252 static constexpr
bool HAS_RGBu8 =
true;
256 : m_obj(*const_cast<pcl::PointCloud<pcl::PointXYZRGBA>*>(&obj))
260 inline size_t size()
const {
return m_obj.points.size(); }
262 inline void resize(
const size_t N) { m_obj.points.resize(N); }
266 m_obj.height = height;
271 template <
typename T>
274 const pcl::PointXYZRGBA& p = m_obj.points[idx];
283 pcl::PointXYZRGBA& p = m_obj.points[idx];
287 p.r = p.g = p.b = 255;
293 pcl::PointXYZRGBA& p = m_obj.points[idx];
294 p.x = p.y = p.z = std::numeric_limits<float>::quiet_NaN();
298 template <
typename T>
300 const size_t idx, T& x, T& y, T& z,
float& r,
float& g,
float& b)
const 302 const pcl::PointXYZRGBA& p = m_obj.points[idx];
313 const float r,
const float g,
const float b)
315 pcl::PointXYZRGBA& p = m_obj.points[idx];
325 template <
typename T>
327 const size_t idx, T& x, T& y, T& z, uint8_t& r, uint8_t& g,
330 const pcl::PointXYZRGBA& p = m_obj.points[idx];
341 const uint8_t r,
const uint8_t g,
const uint8_t b)
343 pcl::PointXYZRGBA& p = m_obj.points[idx];
354 const size_t idx,
float& r,
float& g,
float& b)
const 356 const pcl::PointXYZRGBA& p = m_obj.points[idx];
363 const size_t idx,
const float r,
const float g,
const float b)
365 pcl::PointXYZRGBA& p = m_obj.points[idx];
373 const size_t idx, uint8_t& r, uint8_t& g, uint8_t& b)
const 375 const pcl::PointXYZRGBA& p = m_obj.points[idx];
382 const size_t idx,
const uint8_t r,
const uint8_t g,
const uint8_t b)
384 pcl::PointXYZRGBA& p = m_obj.points[idx];
void setPointRGBf(const size_t idx, const float r, const float g, const float b)
Set XYZ_RGBf coordinates of i'th point.
PointCloudAdapter(const pcl::PointCloud< pcl::PointXYZRGBA > &obj)
Constructor (accept a const ref for convenience)
pcl::PointCloud< pcl::PointXYZRGBA > & m_obj
void getPointRGBu8(const size_t idx, uint8_t &r, uint8_t &g, uint8_t &b) const
Get RGBu8 color of i'th point.
void setPointRGBu8(const size_t idx, const uint8_t r, const uint8_t g, const uint8_t b)
Set RGBu8 coordinates of i'th point.
void getPointXYZ_RGBf(const size_t idx, T &x, T &y, T &z, float &r, float &g, float &b) const
Get XYZ_RGBf coordinates of i'th point.
void getPointXYZ_RGBu8(const size_t idx, T &x, T &y, T &z, uint8_t &r, uint8_t &g, uint8_t &b) const
Get XYZ_RGBu8 coordinates of i'th point.
void setDimensions(size_t height, size_t width)
Set height and width (for organized)
size_t size() const
Get number of points.
void setPointXYZ(const size_t idx, const coords_t x, const coords_t y, const coords_t z)
Set XYZ coordinates of i'th point.
size_t size() const
Get number of points.
size_t size() const
Get number of points.
void setPointXYZ_RGBu8(const size_t idx, const coords_t x, const coords_t y, const coords_t z, const uint8_t r, const uint8_t g, const uint8_t b)
Set XYZ_RGBu8 coordinates of i'th point.
void getPointXYZ(const size_t idx, T &x, T &y, T &z) const
Get XYZ coordinates of i'th point.
void getPointXYZ(const size_t idx, T &x, T &y, T &z) const
Get XYZ coordinates of i'th point.
void setPointXYZ(const size_t idx, const coords_t x, const coords_t y, const coords_t z)
Set XYZ coordinates of i'th point.
void setPointRGBf(const size_t idx, const float r, const float g, const float b)
Set XYZ_RGBf coordinates of i'th point.
void resize(const size_t N)
Set number of points (to uninitialized values)
void setPointXYZ(const size_t idx, const coords_t x, const coords_t y, const coords_t z)
Set XYZ coordinates of i'th point.
An adapter to different kinds of point cloud object.
pcl::PointCloud< pcl::PointXYZRGB > & m_obj
float coords_t
The type of each point XYZ coordinates.
void resize(const size_t N)
Set number of points (to uninitialized values)
void setPointXYZ_RGBu8(const size_t idx, const coords_t x, const coords_t y, const coords_t z, const uint8_t r, const uint8_t g, const uint8_t b)
Set XYZ_RGBu8 coordinates of i'th point.
void getPointXYZ_RGBf(const size_t idx, T &x, T &y, T &z, float &r, float &g, float &b) const
Get XYZ_RGBf coordinates of i'th point.
PointCloudAdapter(const pcl::PointCloud< pcl::PointXYZ > &obj)
Constructor (accept a const ref for convenience)
void setPointXYZ_RGBf(const size_t idx, const coords_t x, const coords_t y, const coords_t z, const float r, const float g, const float b)
Set XYZ_RGBf coordinates of i'th point.
void setDimensions(size_t height, size_t width)
Set height and width (for organized)
void setInvalidPoint(const size_t idx)
Set Invalid Point.
void getPointXYZ(const size_t idx, T &x, T &y, T &z) const
Get XYZ coordinates of i'th point.
float coords_t
The type of each point XYZ coordinates.
void resize(const size_t N)
Set number of points (to uninitialized values)
void getPointRGBu8(const size_t idx, uint8_t &r, uint8_t &g, uint8_t &b) const
Get RGBu8 color of i'th point.
void getPointRGBf(const size_t idx, float &r, float &g, float &b) const
Get RGBf color of i'th point.
The namespace for 3D scene representation and rendering.
pcl::PointCloud< pcl::PointXYZ > & m_obj
void setDimensions(size_t height, size_t width)
Set height and width (for organized)
void getPointRGBf(const size_t idx, float &r, float &g, float &b) const
Get RGBf color of i'th point.
void setInvalidPoint(const size_t idx)
Set Invalid Point.
void getPointXYZ_RGBu8(const size_t idx, T &x, T &y, T &z, uint8_t &r, uint8_t &g, uint8_t &b) const
Get XYZ_RGBu8 coordinates of i'th point.
void setPointXYZ_RGBf(const size_t idx, const coords_t x, const coords_t y, const coords_t z, const float r, const float g, const float b)
Set XYZ_RGBf coordinates of i'th point.
PointCloudAdapter(const pcl::PointCloud< pcl::PointXYZRGB > &obj)
Constructor (accept a const ref for convenience)
void setPointRGBu8(const size_t idx, const uint8_t r, const uint8_t g, const uint8_t b)
Set RGBu8 coordinates of i'th point.
float coords_t
The type of each point XYZ coordinates.