MRPT  1.9.9
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-2019, 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 
123  /** Save to a text file. In each line contains X Y Z (meters) R G B (range
124  * [0,1]) for each point in the map.
125  * Returns false if any error occured, true elsewere.
126  */
127  bool save3D_and_colour_to_text_file(const std::string& file) const;
128 
129  /** Changes a given point from map. First index is 0.
130  * \exception Throws std::exception on index out of bound.
131  */
132  void setPointRGB(
133  size_t index, float x, float y, float z, float R, float G,
134  float B) override;
135 
136  /** Adds a new point given its coordinates and color (colors range is [0,1])
137  */
138  void insertPointRGB(
139  float x, float y, float z, float R, float G, float B) override;
140 
141  /** Changes just the color of a given point from the map. First index is 0.
142  * \exception Throws std::exception on index out of bound.
143  */
144  void setPointColor(size_t index, float R, float G, float B);
145 
146  /** Like \c setPointColor but without checking for out-of-index erors */
147  inline void setPointColor_fast(size_t index, float R, float G, float B)
148  {
149  m_color_R[index] = R;
150  m_color_G[index] = G;
151  m_color_B[index] = B;
152  }
153 
154  /** Retrieves a point and its color (colors range is [0,1])
155  */
156  void getPointRGB(
157  size_t index, float& x, float& y, float& z, float& R, float& G,
158  float& B) const override;
159 
160  /** Retrieves a point color (colors range is [0,1]) */
161  void getPointColor(size_t index, float& R, float& G, float& B) const;
162 
163  /** Like \c getPointColor but without checking for out-of-index erors */
164  inline void getPointColor_fast(
165  size_t index, float& R, float& G, float& B) const
166  {
167  R = m_color_R[index];
168  G = m_color_G[index];
169  B = m_color_B[index];
170  }
171 
172  /** Returns true if the point map has a color field for each point */
173  bool hasColorPoints() const override { return true; }
174  /** Override of the default 3D scene builder to account for the individual
175  * points' color.
176  */
177  void getAs3DObject(mrpt::opengl::CSetOfObjects::Ptr& outObj) const override;
178 
179  /** Colour a set of points from a CObservationImage and the global pose of
180  * the robot */
182  const mrpt::obs::CObservationImage& obs,
183  const mrpt::poses::CPose3D& robotPose);
184 
185  /** The choices for coloring schemes:
186  * - cmFromHeightRelativeToSensor: The Z coordinate wrt the sensor will
187  *be
188  *used to obtain the color using the limits z_min,z_max.
189  * - cmFromIntensityImage: When inserting 3D range scans, take the
190  *color
191  *from the intensity image channel, if available.
192  * \sa TColourOptions
193  */
195  {
200  // Remember: if new values are added, also update TEnumType below!
201  };
202 
203  /** The definition of parameters for generating colors from laser scans */
205  {
206  /** Initilization of default parameters */
207  TColourOptions();
208  void loadFromConfigFile(
210  const std::string& section) override; // See base docs
211  void dumpToTextStream(
212  std::ostream& out) const override; // See base docs
213 
215  float z_min{-10}, z_max{10};
216  float d_max{5};
217  };
218 
219  /** The options employed when inserting laser scans in the map. */
221 
222  /** Reset the minimum-observed-distance buffer for all the points to a
223  * predefined value */
224  void resetPointsMinDist(float defValue = 2000.0f);
225 
226  /** @name PCL library support
227  @{ */
228 
229 #if defined(PCL_LINEAR_VERSION)
230  /** Save the point cloud as a PCL PCD file, in either ASCII or binary format
231  * \return false on any error */
232  inline bool savePCDFile(
233  const std::string& filename, bool save_as_binary) const
234  {
235  pcl::PointCloud<pcl::PointXYZRGB> cloud;
236 
237  const size_t nThis = this->size();
238 
239  // Fill in the cloud data
240  cloud.width = nThis;
241  cloud.height = 1;
242  cloud.is_dense = false;
243  cloud.points.resize(cloud.width * cloud.height);
244 
245  const float f = 255.f;
246 
247  union myaux_t {
248  uint8_t rgb[4];
249  float f;
250  } aux_val;
251 
252  for (size_t i = 0; i < nThis; ++i)
253  {
254  cloud.points[i].x = m_x[i];
255  cloud.points[i].y = m_y[i];
256  cloud.points[i].z = m_z[i];
257 
258  aux_val.rgb[0] = static_cast<uint8_t>(this->m_color_B[i] * f);
259  aux_val.rgb[1] = static_cast<uint8_t>(this->m_color_G[i] * f);
260  aux_val.rgb[2] = static_cast<uint8_t>(this->m_color_R[i] * f);
261 
262  cloud.points[i].rgb = aux_val.f;
263  }
264 
265  return 0 == pcl::io::savePCDFile(filename, cloud, save_as_binary);
266  }
267 #endif
268 
269  /** Loads a PCL point cloud (WITH RGB information) into this MRPT class (for
270  * clouds without RGB data, see CPointsMap::setFromPCLPointCloud() ).
271  * Usage example:
272  * \code
273  * pcl::PointCloud<pcl::PointXYZRGB> cloud;
274  * mrpt::maps::CColouredPointsMap pc;
275  *
276  * pc.setFromPCLPointCloudRGB(cloud);
277  * \endcode
278  * \sa CPointsMap::setFromPCLPointCloud()
279  */
280  template <class POINTCLOUD>
281  void setFromPCLPointCloudRGB(const POINTCLOUD& cloud)
282  {
283  const size_t N = cloud.points.size();
284  clear();
285  reserve(N);
286  const float f = 1.0f / 255.0f;
287  for (size_t i = 0; i < N; ++i)
288  this->insertPoint(
289  cloud.points[i].x, cloud.points[i].y, cloud.points[i].z,
290  cloud.points[i].r * f, cloud.points[i].g * f,
291  cloud.points[i].b * f);
292  }
293 
294  /** Like CPointsMap::getPCLPointCloud() but for PointCloud<PointXYZRGB> */
295  template <class POINTCLOUD>
296  void getPCLPointCloudXYZRGB(POINTCLOUD& cloud) const
297  {
298  const size_t nThis = this->size();
299  this->getPCLPointCloud(cloud); // 1st: xyz data
300  // 2nd: RGB data
301  for (size_t i = 0; i < nThis; ++i)
302  {
303  float R, G, B;
304  this->getPointColor_fast(i, R, G, B);
305  cloud.points[i].r = static_cast<uint8_t>(R * 255);
306  cloud.points[i].g = static_cast<uint8_t>(G * 255);
307  cloud.points[i].b = static_cast<uint8_t>(B * 255);
308  }
309  }
310  /** @} */
311 
312  protected:
313  /** The color data */
315 
316  /** Minimum distance from where the points have been seen */
317  // std::vector<float> m_min_dist;
318 
319  /** Clear the map, erasing all the points */
320  void internal_clear() override;
321 
322  /** @name Redefinition of PLY Import virtual methods from CPointsMap
323  @{ */
324  /** In a base class, will be called after PLY_import_set_vertex_count() once
325  * for each loaded point.
326  * \param pt_color Will be nullptr if the loaded file does not provide
327  * color info.
328  */
330  const size_t idx, const mrpt::math::TPoint3Df& pt,
331  const mrpt::img::TColorf* pt_color = nullptr) override;
332 
333  /** In a base class, reserve memory to prepare subsequent calls to
334  * PLY_import_set_vertex */
335  void PLY_import_set_vertex_count(const size_t N) override;
336  /** @} */
337 
338  /** @name Redefinition of PLY Export virtual methods from CPointsMap
339  @{ */
341  const size_t idx, mrpt::math::TPoint3Df& pt, bool& pt_has_color,
342  mrpt::img::TColorf& pt_color) const override;
343  /** @} */
344 
346  mrpt::maps::CPointsMap::TInsertionOptions insertionOpts;
347  mrpt::maps::CPointsMap::TLikelihoodOptions likelihoodOpts;
350 
351 }; // End of class def.
352 
353 } // namespace maps
354 
355 #include <mrpt/opengl/pointcloud_adapters.h>
356 namespace opengl
357 {
358 /** Specialization
359  * mrpt::opengl::PointCloudAdapter<mrpt::maps::CColouredPointsMap> \ingroup
360  * mrpt_adapters_grp */
361 template <>
363 {
364  private:
366 
367  public:
368  /** The type of each point XYZ coordinates */
369  using coords_t = float;
370  /** Has any color RGB info? */
371  static constexpr bool HAS_RGB = true;
372  /** Has native RGB info (as floats)? */
373  static constexpr bool HAS_RGBf = true;
374  /** Has native RGB info (as uint8_t)? */
375  static constexpr bool HAS_RGBu8 = false;
376 
377  /** Constructor (accept a const ref for convenience) */
379  : m_obj(*const_cast<mrpt::maps::CColouredPointsMap*>(&obj))
380  {
381  }
382  /** Get number of points */
383  inline size_t size() const { return m_obj.size(); }
384  /** Set number of points (to uninitialized values) */
385  inline void resize(const size_t N) { m_obj.resize(N); }
386  /** Does nothing as of now */
387  inline void setDimensions(const size_t& height, const size_t& width) {}
388  /** Get XYZ coordinates of i'th point */
389  template <typename T>
390  inline void getPointXYZ(const size_t idx, T& x, T& y, T& z) const
391  {
392  m_obj.getPointFast(idx, x, y, z);
393  }
394  /** Set XYZ coordinates of i'th point */
395  inline void setPointXYZ(
396  const size_t idx, const coords_t x, const coords_t y, const coords_t z)
397  {
398  m_obj.setPointFast(idx, x, y, z);
399  }
400 
401  /** Get XYZ_RGBf coordinates of i'th point */
402  template <typename T>
403  inline void getPointXYZ_RGBf(
404  const size_t idx, T& x, T& y, T& z, float& r, float& g, float& b) const
405  {
406  m_obj.getPointRGB(idx, x, y, z, r, g, b);
407  }
408  /** Set XYZ_RGBf coordinates of i'th point */
409  inline void setPointXYZ_RGBf(
410  const size_t idx, const coords_t x, const coords_t y, const coords_t z,
411  const float r, const float g, const float b)
412  {
413  m_obj.setPointRGB(idx, x, y, z, r, g, b);
414  }
415 
416  /** Get XYZ_RGBu8 coordinates of i'th point */
417  template <typename T>
418  inline void getPointXYZ_RGBu8(
419  const size_t idx, T& x, T& y, T& z, uint8_t& r, uint8_t& g,
420  uint8_t& b) const
421  {
422  float Rf, Gf, Bf;
423  m_obj.getPointRGB(idx, x, y, z, Rf, Gf, Bf);
424  r = Rf * 255;
425  g = Gf * 255;
426  b = Bf * 255;
427  }
428  /** Set XYZ_RGBu8 coordinates of i'th point */
429  inline void setPointXYZ_RGBu8(
430  const size_t idx, const coords_t x, const coords_t y, const coords_t z,
431  const uint8_t r, const uint8_t g, const uint8_t b)
432  {
433  m_obj.setPointRGB(idx, x, y, z, r / 255.f, g / 255.f, b / 255.f);
434  }
435 
436  /** Get RGBf color of i'th point */
437  inline void getPointRGBf(
438  const size_t idx, float& r, float& g, float& b) const
439  {
440  m_obj.getPointColor_fast(idx, r, g, b);
441  }
442  /** Set XYZ_RGBf coordinates of i'th point */
443  inline void setPointRGBf(
444  const size_t idx, const float r, const float g, const float b)
445  {
446  m_obj.setPointColor_fast(idx, r, g, b);
447  }
448 
449  /** Get RGBu8 color of i'th point */
450  inline void getPointRGBu8(
451  const size_t idx, uint8_t& r, uint8_t& g, uint8_t& b) const
452  {
453  float R, G, B;
454  m_obj.getPointColor_fast(idx, R, G, B);
455  r = R * 255;
456  g = G * 255;
457  b = B * 255;
458  }
459  /** Set RGBu8 coordinates of i'th point */
460  inline void setPointRGBu8(
461  const size_t idx, const uint8_t r, const uint8_t g, const uint8_t b)
462  {
463  m_obj.setPointColor_fast(idx, r / 255.f, g / 255.f, b / 255.f);
464  }
465 
466  /** Set XYZ coordinates of i'th point */
467  inline void setInvalidPoint(const size_t idx)
468  {
469  THROW_EXCEPTION("mrpt::maps::CColouredPointsMap needs to be dense");
470  }
471 
472 }; // end of PointCloudAdapter<mrpt::maps::CColouredPointsMap>
473 } // namespace opengl
474 } // namespace mrpt
475 
479  cmFromHeightRelativeToSensor);
482  cmFromHeightRelativeToSensorJet);
485  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:481
GLdouble GLdouble z
Definition: glext.h:3879
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
bool save3D_and_colour_to_text_file(const std::string &file) const
Save to a text file.
#define THROW_EXCEPTION(msg)
Definition: exceptions.h:67
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.
Declares a class derived from "CObservation" that encapsules a 3D range scan measurement, as from a time-of-flight range camera or any other RGBD sensor.
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:644
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
GLsizei GLsizei GLuint * obj
Definition: glext.h:4085
GLenum GLsizei width
Definition: glext.h:3535
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:221
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.
Lightweight 3D point (float version).
Definition: TPoint3D.h:21
GLuint index
Definition: glext.h:4068
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 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&#39;th point.
GLubyte g
Definition: glext.h:6372
GLubyte GLubyte b
Definition: glext.h:6372
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:1010
A map of 2D/3D points with individual colours (RGB).
GLsizei const GLchar ** string
Definition: glext.h:4116
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 setDimensions(const size_t &height, const size_t &width)
Does nothing as of now.
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:1123
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])
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...
GLdouble GLdouble GLdouble r
Definition: glext.h:3711
mrpt::aligned_std_vector< float > m_y
Definition: CPointsMap.h:1123
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:279
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()
A RGB color - floats in the range [0,1].
Definition: TColor.h:78
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 resize(size_t newLength) override
Resizes all point buffers so they can hold the given number of points: newly created points are set t...
GLsizei GLsizei GLchar * source
Definition: glext.h:4097
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)
GLenum GLint GLint y
Definition: glext.h:3542
#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.
GLenum GLint x
Definition: glext.h:3542
void impl_copyFrom(const CPointsMap &obj) override
Virtual assignment operator, copies as much common data (XYZ, color,...) as possible from the source ...
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&#39;th point.
GLenum GLsizei GLsizei height
Definition: glext.h:3558
#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:1123
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:441
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 1.9.9 Git: cfb2df9d3 Fri Nov 15 06:57:14 2019 +0100 at vie nov 15 07:00:11 CET 2019