MRPT  2.0.1
CColouredPointsMap.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
11 #include <mrpt/maps/CPointsMap.h>
12 #include <mrpt/math/CMatrixF.h>
17 
18 namespace mrpt
19 {
20 namespace maps
21 {
22 /** A map of 2D/3D points with individual colours (RGB).
23  * For different color schemes, see CColouredPointsMap::colorScheme
24  * Colors are defined in the range [0,1].
25  * \sa mrpt::maps::CPointsMap, mrpt::maps::CMetricMap,
26  * mrpt::serialization::CSerializable
27  * \ingroup mrpt_maps_grp
28  */
30 {
32 
33  public:
34  CColouredPointsMap() = default;
35 
38  {
39  impl_copyFrom(o);
40  }
42  {
43  impl_copyFrom(o);
44  return *this;
45  }
47  {
48  impl_copyFrom(o);
49  return *this;
50  }
51 
52  // --------------------------------------------
53  /** @name Pure virtual interfaces to be implemented by any class derived
54  from CPointsMap
55  @{ */
56 
57  void reserve(size_t newLength) override; // See base class docs
58  void resize(size_t newLength) override; // See base class docs
59  void setSize(size_t newLength) override; // See base class docs
60 
61  /** The virtual method for \a insertPoint() *without* calling
62  * mark_as_modified() */
63  void insertPointFast(float x, float y, float z = 0) override;
64 
65  /** Get all the data fields for one point as a vector: [X Y Z R G B]
66  * Unlike getPointAllFields(), this method does not check for index out of
67  * bounds
68  * \sa getPointAllFields, setPointAllFields, setPointAllFieldsFast
69  */
71  const size_t index, std::vector<float>& point_data) const override
72  {
73  point_data.resize(6);
74  point_data[0] = m_x[index];
75  point_data[1] = m_y[index];
76  point_data[2] = m_z[index];
77  point_data[3] = m_color_R[index];
78  point_data[4] = m_color_G[index];
79  point_data[5] = m_color_B[index];
80  }
81 
82  /** Set all the data fields for one point as a vector: [X Y Z R G B]
83  * Unlike setPointAllFields(), this method does not check for index out of
84  * bounds
85  * \sa setPointAllFields, getPointAllFields, getPointAllFieldsFast
86  */
88  const size_t index, const std::vector<float>& point_data) override
89  {
90  ASSERTDEB_(point_data.size() == 6);
91  m_x[index] = point_data[0];
92  m_y[index] = point_data[1];
93  m_z[index] = point_data[2];
94  m_color_R[index] = point_data[3];
95  m_color_G[index] = point_data[4];
96  m_color_B[index] = point_data[5];
97  }
98 
99  /** See CPointsMap::loadFromRangeScan() */
100  void loadFromRangeScan(
101  const mrpt::obs::CObservation2DRangeScan& rangeScan,
102  const mrpt::poses::CPose3D* robotPose = nullptr) override;
103  /** See CPointsMap::loadFromRangeScan() */
104  void loadFromRangeScan(
105  const mrpt::obs::CObservation3DRangeScan& rangeScan,
106  const mrpt::poses::CPose3D* robotPose = nullptr) override;
107 
108  protected:
109  void impl_copyFrom(const CPointsMap& obj) override;
111  const CPointsMap& anotherMap, const size_t nPreviousPoints) override;
112 
113  // Friend methods:
114  template <class Derived>
116  template <class Derived>
117  friend struct detail::pointmap_traits;
118 
119  public:
120  /** @} */
121 
122  /** Save to a text file. In each line contains X Y Z (meters) R G B (range
123  * [0,1]) for each point in the map.
124  * Returns false if any error occured, true elsewere.
125  */
126  bool save3D_and_colour_to_text_file(const std::string& file) const;
127 
128  /** Changes a given point from map. First index is 0.
129  * \exception Throws std::exception on index out of bound.
130  */
131  void setPointRGB(
132  size_t index, float x, float y, float z, float R, float G,
133  float B) override;
134 
135  /** Adds a new point given its coordinates and color (colors range is [0,1])
136  */
137  void insertPointRGB(
138  float x, float y, float z, float R, float G, float B) override;
139 
140  /** Changes just the color of a given point from the map. First index is 0.
141  * \exception Throws std::exception on index out of bound.
142  */
143  void setPointColor(size_t index, float R, float G, float B);
144 
145  /** Like \c setPointColor but without checking for out-of-index erors */
146  inline void setPointColor_fast(size_t index, float R, float G, float B)
147  {
148  m_color_R[index] = R;
149  m_color_G[index] = G;
150  m_color_B[index] = B;
151  }
152 
153  /** Retrieves a point and its color (colors range is [0,1])
154  */
155  void getPointRGB(
156  size_t index, float& x, float& y, float& z, float& R, float& G,
157  float& B) const override;
158 
159  /** Retrieves a point color (colors range is [0,1]) */
160  void getPointColor(size_t index, float& R, float& G, float& B) const;
161 
162  /** Like \c getPointColor but without checking for out-of-index erors */
163  inline void getPointColor_fast(
164  size_t index, float& R, float& G, float& B) const
165  {
166  R = m_color_R[index];
167  G = m_color_G[index];
168  B = m_color_B[index];
169  }
170 
171  /** Returns true if the point map has a color field for each point */
172  bool hasColorPoints() const override { return true; }
173  /** Override of the default 3D scene builder to account for the individual
174  * points' color.
175  */
176  void getAs3DObject(mrpt::opengl::CSetOfObjects::Ptr& outObj) const override;
177 
178  /** Colour a set of points from a CObservationImage and the global pose of
179  * the robot */
181  const mrpt::obs::CObservationImage& obs,
182  const mrpt::poses::CPose3D& robotPose);
183 
184  /** The choices for coloring schemes:
185  * - cmFromHeightRelativeToSensor: The Z coordinate wrt the sensor will
186  *be
187  *used to obtain the color using the limits z_min,z_max.
188  * - cmFromIntensityImage: When inserting 3D range scans, take the
189  *color
190  *from the intensity image channel, if available.
191  * \sa TColourOptions
192  */
194  {
199  // Remember: if new values are added, also update TEnumType below!
200  };
201 
202  /** The definition of parameters for generating colors from laser scans */
204  {
205  /** Initilization of default parameters */
206  TColourOptions();
207  void loadFromConfigFile(
208  const mrpt::config::CConfigFileBase& source,
209  const std::string& section) override; // See base docs
210  void dumpToTextStream(
211  std::ostream& out) const override; // See base docs
212 
214  float z_min{-10}, z_max{10};
215  float d_max{5};
216  };
217 
218  /** The options employed when inserting laser scans in the map. */
220 
221  /** Reset the minimum-observed-distance buffer for all the points to a
222  * predefined value */
223  void resetPointsMinDist(float defValue = 2000.0f);
224 
225  /** @name PCL library support
226  @{ */
227 
228 #if defined(PCL_LINEAR_VERSION)
229  /** Save the point cloud as a PCL PCD file, in either ASCII or binary format
230  * \return false on any error */
231  inline bool savePCDFile(
232  const std::string& filename, bool save_as_binary) const
233  {
234  pcl::PointCloud<pcl::PointXYZRGB> cloud;
235 
236  const size_t nThis = this->size();
237 
238  // Fill in the cloud data
239  cloud.width = nThis;
240  cloud.height = 1;
241  cloud.is_dense = false;
242  cloud.points.resize(cloud.width * cloud.height);
243 
244  const float f = 255.f;
245 
246  union myaux_t {
247  uint8_t rgb[4];
248  float f;
249  } aux_val;
250 
251  for (size_t i = 0; i < nThis; ++i)
252  {
253  cloud.points[i].x = m_x[i];
254  cloud.points[i].y = m_y[i];
255  cloud.points[i].z = m_z[i];
256 
257  aux_val.rgb[0] = static_cast<uint8_t>(this->m_color_B[i] * f);
258  aux_val.rgb[1] = static_cast<uint8_t>(this->m_color_G[i] * f);
259  aux_val.rgb[2] = static_cast<uint8_t>(this->m_color_R[i] * f);
260 
261  cloud.points[i].rgb = aux_val.f;
262  }
263 
264  return 0 == pcl::io::savePCDFile(filename, cloud, save_as_binary);
265  }
266 #endif
267 
268  /** Loads a PCL point cloud (WITH RGB information) into this MRPT class (for
269  * clouds without RGB data, see CPointsMap::setFromPCLPointCloud() ).
270  * Usage example:
271  * \code
272  * pcl::PointCloud<pcl::PointXYZRGB> cloud;
273  * mrpt::maps::CColouredPointsMap pc;
274  *
275  * pc.setFromPCLPointCloudRGB(cloud);
276  * \endcode
277  * \sa CPointsMap::setFromPCLPointCloud()
278  */
279  template <class POINTCLOUD>
280  void setFromPCLPointCloudRGB(const POINTCLOUD& cloud)
281  {
282  const size_t N = cloud.points.size();
283  clear();
284  reserve(N);
285  const float f = 1.0f / 255.0f;
286  for (size_t i = 0; i < N; ++i)
287  this->insertPoint(
288  cloud.points[i].x, cloud.points[i].y, cloud.points[i].z,
289  cloud.points[i].r * f, cloud.points[i].g * f,
290  cloud.points[i].b * f);
291  }
292 
293  /** Like CPointsMap::getPCLPointCloud() but for PointCloud<PointXYZRGB> */
294  template <class POINTCLOUD>
295  void getPCLPointCloudXYZRGB(POINTCLOUD& cloud) const
296  {
297  const size_t nThis = this->size();
298  this->getPCLPointCloud(cloud); // 1st: xyz data
299  // 2nd: RGB data
300  for (size_t i = 0; i < nThis; ++i)
301  {
302  float R, G, B;
303  this->getPointColor_fast(i, R, G, B);
304  cloud.points[i].r = static_cast<uint8_t>(R * 255);
305  cloud.points[i].g = static_cast<uint8_t>(G * 255);
306  cloud.points[i].b = static_cast<uint8_t>(B * 255);
307  }
308  }
309  /** @} */
310 
311  protected:
312  /** The color data */
314 
315  /** Minimum distance from where the points have been seen */
316  // std::vector<float> m_min_dist;
317 
318  /** Clear the map, erasing all the points */
319  void internal_clear() override;
320 
321  /** @name Redefinition of PLY Import virtual methods from CPointsMap
322  @{ */
323  /** In a base class, will be called after PLY_import_set_vertex_count() once
324  * for each loaded point.
325  * \param pt_color Will be nullptr if the loaded file does not provide
326  * color info.
327  */
329  const size_t idx, const mrpt::math::TPoint3Df& pt,
330  const mrpt::img::TColorf* pt_color = nullptr) override;
331 
332  /** In a base class, reserve memory to prepare subsequent calls to
333  * PLY_import_set_vertex */
334  void PLY_import_set_vertex_count(const size_t N) override;
335  /** @} */
336 
337  /** @name Redefinition of PLY Export virtual methods from CPointsMap
338  @{ */
340  const size_t idx, mrpt::math::TPoint3Df& pt, bool& pt_has_color,
341  mrpt::img::TColorf& pt_color) const override;
342  /** @} */
343 
345  mrpt::maps::CPointsMap::TInsertionOptions insertionOpts;
346  mrpt::maps::CPointsMap::TLikelihoodOptions likelihoodOpts;
349 
350 }; // End of class def.
351 
352 } // namespace maps
353 
354 #include <mrpt/opengl/pointcloud_adapters.h>
355 namespace opengl
356 {
357 /** Specialization
358  * mrpt::opengl::PointCloudAdapter<mrpt::maps::CColouredPointsMap> \ingroup
359  * mrpt_adapters_grp */
360 template <>
362 {
363  private:
365 
366  public:
367  /** The type of each point XYZ coordinates */
368  using coords_t = float;
369  /** Has any color RGB info? */
370  static constexpr bool HAS_RGB = true;
371  /** Has native RGB info (as floats)? */
372  static constexpr bool HAS_RGBf = true;
373  /** Has native RGB info (as uint8_t)? */
374  static constexpr bool HAS_RGBu8 = false;
375 
376  /** Constructor (accept a const ref for convenience) */
378  : m_obj(*const_cast<mrpt::maps::CColouredPointsMap*>(&obj))
379  {
380  }
381  /** Get number of points */
382  inline size_t size() const { return m_obj.size(); }
383  /** Set number of points (to uninitialized values) */
384  inline void resize(const size_t N) { m_obj.resize(N); }
385  /** Does nothing as of now */
386  inline void setDimensions(size_t height, size_t width) {}
387  /** Get XYZ coordinates of i'th point */
388  template <typename T>
389  inline void getPointXYZ(const size_t idx, T& x, T& y, T& z) const
390  {
391  m_obj.getPointFast(idx, x, y, z);
392  }
393  /** Set XYZ coordinates of i'th point */
394  inline void setPointXYZ(
395  const size_t idx, const coords_t x, const coords_t y, const coords_t z)
396  {
397  m_obj.setPointFast(idx, x, y, z);
398  }
399 
400  /** Get XYZ_RGBf coordinates of i'th point */
401  template <typename T>
402  inline void getPointXYZ_RGBAf(
403  const size_t idx, T& x, T& y, T& z, float& r, float& g, float& b,
404  float& a) const
405  {
406  m_obj.getPointRGB(idx, x, y, z, r, g, b);
407  a = 1.0f;
408  }
409  /** Set XYZ_RGBf coordinates of i'th point */
410  inline void setPointXYZ_RGBAf(
411  const size_t idx, const coords_t x, const coords_t y, const coords_t z,
412  const float r, const float g, const float b,
413  [[maybe_unused]] const float a)
414  {
415  m_obj.setPointRGB(idx, x, y, z, r, g, b);
416  }
417 
418  /** Get XYZ_RGBu8 coordinates of i'th point */
419  template <typename T>
420  inline void getPointXYZ_RGBu8(
421  const size_t idx, T& x, T& y, T& z, uint8_t& r, uint8_t& g,
422  uint8_t& b) const
423  {
424  float Rf, Gf, Bf;
425  m_obj.getPointRGB(idx, x, y, z, Rf, Gf, Bf);
426  r = Rf * 255;
427  g = Gf * 255;
428  b = Bf * 255;
429  }
430  /** Set XYZ_RGBu8 coordinates of i'th point */
431  inline void setPointXYZ_RGBu8(
432  const size_t idx, const coords_t x, const coords_t y, const coords_t z,
433  const uint8_t r, const uint8_t g, const uint8_t b)
434  {
435  m_obj.setPointRGB(idx, x, y, z, r / 255.f, g / 255.f, b / 255.f);
436  }
437 
438  /** Get RGBf color of i'th point */
439  inline void getPointRGBf(
440  const size_t idx, float& r, float& g, float& b) const
441  {
442  m_obj.getPointColor_fast(idx, r, g, b);
443  }
444  /** Set XYZ_RGBf coordinates of i'th point */
445  inline void setPointRGBf(
446  const size_t idx, const float r, const float g, const float b)
447  {
448  m_obj.setPointColor_fast(idx, r, g, b);
449  }
450 
451  /** Get RGBu8 color of i'th point */
452  inline void getPointRGBu8(
453  const size_t idx, uint8_t& r, uint8_t& g, uint8_t& b) const
454  {
455  float R, G, B;
456  m_obj.getPointColor_fast(idx, R, G, B);
457  r = mrpt::f2u8(R);
458  g = mrpt::f2u8(G);
459  b = mrpt::f2u8(B);
460  }
461  /** Set RGBu8 coordinates of i'th point */
462  inline void setPointRGBu8(
463  const size_t idx, const uint8_t r, const uint8_t g, const uint8_t b)
464  {
465  m_obj.setPointColor_fast(idx, r / 255.f, g / 255.f, b / 255.f);
466  }
467 
468  /** Set XYZ coordinates of i'th point */
469  inline void setInvalidPoint(const size_t idx)
470  {
471  m_obj.setPointFast(idx, 0, 0, 0);
472  }
473 
474 }; // end of PointCloudAdapter<mrpt::maps::CColouredPointsMap>
475 } // namespace opengl
476 } // namespace mrpt
477 
481  cmFromHeightRelativeToSensor);
484  cmFromHeightRelativeToSensorJet);
487  cmFromHeightRelativeToSensorGray);
PointCloudAdapter(const mrpt::maps::CColouredPointsMap &obj)
Constructor (accept a const ref for convenience)
void clear()
Erase all the contents of the map.
Definition: CMetricMap.cpp:30
void setSize(size_t newLength) override
Resizes all point buffers so they can hold the given number of points, erasing all previous contents ...
void addFrom_classSpecific(const CPointsMap &anotherMap, const size_t nPreviousPoints) override
Auxiliary method called from within addFrom() automatically, to finish the copying of class-specific ...
TColouringMethod
The choices for coloring schemes:
Declares a class derived from "CObservation" that encapsules an image from a camera, whose relative pose to robot is also stored.
void getPointFast(size_t index, float &x, float &y, float &z) const
Just like getPoint() but without checking out-of-bound index and without returning the point weight...
Definition: CPointsMap.h:480
void insertPointFast(float x, float y, float z=0) override
The virtual method for insertPoint() without calling mark_as_modified()
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...
CPointsMap & operator=(const CPointsMap &o)
Definition: CPointsMap.h:120
void setPointXYZ_RGBAf(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, [[maybe_unused]] const float a)
Set XYZ_RGBf coordinates of i&#39;th point.
bool save3D_and_colour_to_text_file(const std::string &file) const
Save to a text file.
void dumpToTextStream(std::ostream &out) const override
This method should clearly display all the contents of the structure in textual form, sending it to a std::ostream.
void getPointRGBu8(const size_t idx, uint8_t &r, uint8_t &g, uint8_t &b) const
Get RGBu8 color of i&#39;th point.
TColourOptions()
Initilization of default parameters.
const double G
void getPointAllFieldsFast(const size_t index, std::vector< float > &point_data) const override
Get all the data fields for one point as a vector: [X Y Z R G B] Unlike getPointAllFields(), this method does not check for index out of bounds.
void internal_clear() override
Minimum distance from where the points have been seen.
#define MAP_DEFINITION_START(_CLASS_NAME_)
Add a MAP_DEFINITION_START() ...
void loadFromConfigFile(const mrpt::config::CConfigFileBase &source, const std::string &section) override
This method load the options from a ".ini"-like file or memory-stored string list.
void setPointAllFieldsFast(const size_t index, const std::vector< float > &point_data) override
Set all the data fields for one point as a vector: [X Y Z R G B] Unlike setPointAllFields(), this method does not check for index out of bounds.
A range or depth 3D scan measurement, as from a time-of-flight range camera or a structured-light dep...
mrpt::aligned_std_vector< float > m_color_R
The color data.
CColouredPointsMap & operator=(const CColouredPointsMap &o)
void setPointColor_fast(size_t index, float R, float G, float B)
Like setPointColor but without checking for out-of-index erors.
void insertPoint(float x, float y, float z=0)
Provides a way to insert (append) individual points into the map: the missing fields of child classes...
Definition: CPointsMap.h:639
void getPointRGBf(const size_t idx, float &r, float &g, float &b) const
Get RGBf color of i&#39;th point.
void setFromPCLPointCloudRGB(const POINTCLOUD &cloud)
Loads a PCL point cloud (WITH RGB information) into this MRPT class (for clouds without RGB data...
float coords_t
The type of each point XYZ coordinates.
std::vector< T, mrpt::aligned_allocator_cpp11< T > > aligned_std_vector
TColourOptions colorScheme
The options employed when inserting laser scans in the map.
void resize(const size_t N)
Set number of points (to uninitialized values)
void reserve(size_t newLength) override
Reserves memory for a given number of points: the size of the map does not change, it only reserves the memory.
With this struct options are provided to the observation insertion process.
Definition: CPointsMap.h:220
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans or other sensors...
Definition: CPointsMap.h:65
This class allows loading and storing values and vectors of different types from a configuration text...
mrpt::aligned_std_vector< float > m_color_B
MRPT_FILL_ENUM_MEMBER(mrpt::maps::CColouredPointsMap::TColouringMethod, cmFromHeightRelativeToSensor)
An adapter to different kinds of point cloud object.
void setPointRGB(size_t index, float x, float y, float z, float R, float G, float B) override
Changes a given point from map.
void PLY_import_set_vertex_count(const size_t N) override
In a base class, reserve memory to prepare subsequent calls to PLY_import_set_vertex.
void insertPointRGB(float x, float y, float z, float R, float G, float B) override
Adds a new point given its coordinates and color (colors range is [0,1])
#define MRPT_ENUM_TYPE_END()
Definition: TEnumType.h:78
void getPCLPointCloud(POINTCLOUD &cloud) const
Use to convert this MRPT point cloud object into a PCL point cloud object (PointCloud<PointXYZ>).
Definition: CPointsMap.h:1003
A map of 2D/3D points with individual colours (RGB).
void setPointFast(size_t index, float x, float y, float z)
Changes the coordinates of the given point (0-based index), without checking for out-of-bounds and wi...
Definition: CPointsMap.h:161
mrpt::aligned_std_vector< float > m_color_G
void setInvalidPoint(const size_t idx)
Set XYZ coordinates of i&#39;th point.
void getPCLPointCloudXYZRGB(POINTCLOUD &cloud) const
Like CPointsMap::getPCLPointCloud() but for PointCloud<PointXYZRGB>
void setPointRGBf(const size_t idx, const float r, const float g, const float b)
Set XYZ_RGBf coordinates of i&#39;th point.
void getPointXYZ(const size_t idx, T &x, T &y, T &z) const
Get XYZ coordinates of i&#39;th point.
mrpt::aligned_std_vector< float > m_z
Definition: CPointsMap.h:1116
void setPointXYZ(const size_t idx, const coords_t x, const coords_t y, const coords_t z)
Set XYZ coordinates of i&#39;th point.
void getPointRGB(size_t index, float &x, float &y, float &z, float &R, float &G, float &B) const override
Retrieves a point and its color (colors range is [0,1])
uint8_t f2u8(const float f)
converts a float [0,1] into an uint8_t [0,255] (without checking for out of bounds) ...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
void setDimensions(size_t height, size_t width)
Does nothing as of now.
mrpt::aligned_std_vector< float > m_y
Definition: CPointsMap.h:1116
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&#39;th point.
const float R
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:85
mrpt::vision::TStereoCalibResults out
bool hasColorPoints() const override
Returns true if the point map has a color field for each point.
void resetPointsMinDist(float defValue=2000.0f)
Reset the minimum-observed-distance buffer for all the points to a predefined value.
Options used when evaluating "computeObservationLikelihood" in the derived classes.
Definition: CPointsMap.h:278
CColouredPointsMap & operator=(const CPointsMap &o)
#define ASSERTDEB_(f)
Defines an assertion mechanism - only when compiled in debug.
Definition: exceptions.h:190
void PLY_export_get_vertex(const size_t idx, mrpt::math::TPoint3Df &pt, bool &pt_has_color, mrpt::img::TColorf &pt_color) const override
In a base class, will be called after PLY_export_get_vertex_count() once for each exported point...
void loadFromRangeScan(const mrpt::obs::CObservation2DRangeScan &rangeScan, const mrpt::poses::CPose3D *robotPose=nullptr) override
See CPointsMap::loadFromRangeScan()
An RGBA color - floats in the range [0,1].
Definition: TColor.h:88
void PLY_import_set_vertex(const size_t idx, const mrpt::math::TPoint3Df &pt, const mrpt::img::TColorf *pt_color=nullptr) override
In a base class, will be called after PLY_import_set_vertex_count() once for each loaded point...
CColouredPointsMap(const CPointsMap &o)
void getPointXYZ_RGBAf(const size_t idx, T &x, T &y, T &z, float &r, float &g, float &b, float &a) const
Get XYZ_RGBf coordinates of i&#39;th point.
void resize(size_t newLength) override
Resizes all point buffers so they can hold the given number of points: newly created points are set t...
void setPointRGBu8(const size_t idx, const uint8_t r, const uint8_t g, const uint8_t b)
Set RGBu8 coordinates of i&#39;th point.
CColouredPointsMap(const CColouredPointsMap &o)
#define DEFINE_SERIALIZABLE(class_name, NS)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
The definition of parameters for generating colors from laser scans.
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&#39;th point.
void getAs3DObject(mrpt::opengl::CSetOfObjects::Ptr &outObj) const override
Override of the default 3D scene builder to account for the individual points&#39; color.
void impl_copyFrom(const CPointsMap &obj) override
Virtual assignment operator, copies as much common data (XYZ, color,...) as possible from the source ...
#define MRPT_ENUM_TYPE_BEGIN(_ENUM_TYPE_WITH_NS)
Definition: TEnumType.h:62
mrpt::aligned_std_vector< float > m_x
The point coordinates.
Definition: CPointsMap.h:1116
bool colourFromObservation(const mrpt::obs::CObservationImage &obs, const mrpt::poses::CPose3D &robotPose)
Colour a set of points from a CObservationImage and the global pose of the robot. ...
#define MAP_DEFINITION_END(_CLASS_NAME_)
size_t size() const
Save the point cloud as a PCL PCD file, in either ASCII or binary format.
Definition: CPointsMap.h:440
void getPointColor_fast(size_t index, float &R, float &G, float &B) const
Like getPointColor but without checking for out-of-index erors.
void getPointColor(size_t index, float &R, float &G, float &B) const
Retrieves a point color (colors range is [0,1])
void setPointColor(size_t index, float R, float G, float B)
Changes just the color of a given point from the map.



Page generated by Doxygen 1.8.14 for MRPT 2.0.1 Git: 0fef1a6d7 Fri Apr 3 23:00:21 2020 +0200 at vie abr 3 23:20:28 CEST 2020