9 #ifndef CColouredPointsMap_H    10 #define CColouredPointsMap_H    30 class CColouredPointsMap : 
public CPointsMap
    48         virtual 
void reserve(
size_t newLength) override;  
    49         virtual 
void resize(
size_t newLength) override;  
    50         virtual 
void setSize(
size_t newLength) override;  
    75                 const size_t index, std::vector<float>& point_data)
 const override    92                 const size_t index, 
const std::vector<float>& point_data)
 override   116                 const CPointsMap& anotherMap, 
const size_t nPreviousPoints) 
override;
   119         template <
class Derived>
   121         template <
class Derived>
   122         friend struct detail::pointmap_traits;
   138                 size_t index, 
float x, 
float y, 
float z, 
float R, 
float G,
   164                 float x, 
float y, 
float z, 
float R, 
float G, 
float B) 
override;
   205                 size_t index, 
float& 
x, 
float& 
y, 
float& 
z, 
float& 
R, 
float& G,
   206                 float& B) 
const override;
   216                 size_t index, 
float& 
R, 
float& G, 
float& B)
 const   286                 const std::string& filename, 
bool save_as_binary) 
const override;
   299         template <
class POINTCLOUD>
   302                 const size_t N = cloud.points.size();
   305                 const float f = 1.0f / 255.0f;
   306                 for (
size_t i = 0; i < N; ++i)
   308                                 cloud.points[i].x, cloud.points[i].y, cloud.points[i].z,
   309                                 cloud.points[i].r * f, cloud.points[i].g * f,
   310                                 cloud.points[i].b * f);
   314         template <
class POINTCLOUD>
   317                 const size_t nThis = this->
size();
   320                 for (
size_t i = 0; i < nThis; ++i)
   324                         cloud.points[i].r = 
static_cast<uint8_t>(
R * 255);
   325                         cloud.points[i].g = 
static_cast<uint8_t>(G * 255);
   326                         cloud.points[i].b = 
static_cast<uint8_t>(B * 255);
   374 #include <mrpt/utils/adapters.h>   390         static const int HAS_RGB = 1;
   392         static const int HAS_RGBf = 1;
   394         static const int HAS_RGBu8 = 0;
   402         inline size_t size()
 const { 
return m_obj.
size(); }
   406         template <
typename T>
   419         template <
typename T>
   421                 const size_t idx, T& 
x, T& 
y, T& 
z, 
float& 
r, 
float& 
g, 
float& 
b)
 const   426         inline void setPointXYZ_RGBf(
   427                 const size_t idx, 
const coords_t 
x, 
const coords_t 
y, 
const coords_t 
z,
   428                 const float r, 
const float g, 
const float b)
   434         template <
typename T>
   454         inline void getPointRGBf(
   455                 const size_t idx, 
float& 
r, 
float& 
g, 
float& 
b)
 const   461                 const size_t idx, 
const float r, 
const float g, 
const float b)
 void clear()
Erase all the contents of the map. 
virtual void getPoint(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]) 
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. 
virtual void setSize(size_t newLength) override
Resizes all point buffers so they can hold the given number of points, erasing all previous contents ...
std::vector< float > m_color_G
virtual 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...
#define MAP_DEFINITION_END(_CLASS_NAME_, _LINKAGE_)
virtual void insertPointFast(float x, float y, float z=0) override
The virtual method for insertPoint() without calling mark_as_modified() 
bool save3D_and_colour_to_text_file(const std::string &file) const
Save to a text file. 
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 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. 
TColourOptions()
Initilization of default parameters. 
virtual void internal_clear() override
Minimum distance from where the points have been seen. 
#define MAP_DEFINITION_START(_CLASS_NAME_)
Add a MAP_DEFINITION_START() ... 
std::vector< float > m_color_B
void insertPoint(float x, float y, float z)
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. 
#define ASSERT_BELOW_(__A, __B)
void setPointColor_fast(size_t index, float R, float G, float B)
Like setPointColor but without checking for out-of-index erors. 
void setFromPCLPointCloudRGB(const POINTCLOUD &cloud)
Loads a PCL point cloud (WITH RGB information) into this MRPT class (for clouds without RGB data...
mrpt::maps::CColouredPointsMap::TColouringMethod enum_t
GLsizei GLsizei GLuint * obj
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string §ion) override
This method load the options from a ".ini"-like file or memory-stored string list. 
#define MRPT_FILL_ENUM_MEMBER(_CLASS, _VALUE)
TColourOptions colorScheme
The options employed when inserting laser scans in the map. 
void getPointXYZ(const size_t idx, T &x, T &y, T &z) const
Get XYZ coordinates of i'th point. 
This class allows loading and storing values and vectors of different types from a configuration text...
virtual 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. 
CColouredPointsMap()
Default constructor. 
With this struct options are provided to the observation insertion process. 
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans or other sensors...
virtual bool hasColorPoints() const override
Returns true if the point map has a color field for each 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. 
mrpt::maps::CColouredPointsMap & m_obj
void dumpToTextStream(mrpt::utils::CStream &out) const override
This method should clearly display all the contents of the structure in textual form, sending it to a CStream. 
Lightweight 3D point (float version). 
virtual void PLY_import_set_vertex(const size_t idx, const mrpt::math::TPoint3Df &pt, const mrpt::utils::TColorf *pt_color=nullptr) override
In a base class, will be called after PLY_import_set_vertex_count() once for each loaded point...
A bidirectional version of std::map, declared as bimap<KEY,VALUE> and which actually contains two std...
void PLY_export_get_vertex(const size_t idx, mrpt::math::TPoint3Df &pt, bool &pt_has_color, mrpt::utils::TColorf &pt_color) const override
In a base class, will be called after PLY_export_get_vertex_count() once for each exported point...
std::shared_ptr< CSetOfObjects > Ptr
virtual 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. 
virtual void setPointFast(size_t index, float x, float y, float z) override
Changes the coordinates of the given point (0-based index), without checking for out-of-bounds and wi...
void insertPoint(const mrpt::math::TPoint3Df &p)
virtual void copyFrom(const CPointsMap &obj) override
Virtual assignment operator, to be implemented in derived classes. 
void getPCLPointCloud(POINTCLOUD &cloud) const
Use to convert this MRPT point cloud object into a PCL point cloud object (PointCloud<PointXYZ>). 
virtual bool savePCDFile(const std::string &filename, bool save_as_binary) const override
Save the point cloud as a PCL PCD file, in either ASCII or binary format. 
void getPointRGBu8(const size_t idx, uint8_t &r, uint8_t &g, uint8_t &b) const
Get RGBu8 color of i'th point. 
A map of 2D/3D points with individual colours (RGB). 
std::vector< float > x
The point coordinates. 
GLsizei const GLchar ** string
A class used to store a 3D point. 
void getPCLPointCloudXYZRGB(POINTCLOUD &cloud) const
Like CPointsMap::getPCLPointCloud() but for PointCloud<PointXYZRGB> 
void setPoint(size_t index, float x, float y, float z)
void setPointRGBf(const size_t idx, const float r, const float g, const float b)
Set XYZ_RGBf coordinates of i'th point. 
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries. 
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
void mark_as_modified() const
Users normally don't need to call this. 
GLdouble GLdouble GLdouble r
PointCloudAdapter(const mrpt::maps::CColouredPointsMap &obj)
Constructor (accept a const ref for convenience) 
virtual void setPoint(size_t index, float x, float y, float z, float R, float G, float B) override
Changes a given point from map. 
A class used to store a 3D pose (a 3D translation + a rotation in 3D). 
void resetPointsMinDist(float defValue=2000.0f)
Reset the minimum-observed-distance buffer for all the points to a predefined value. 
virtual 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. 
virtual void loadFromRangeScan(const mrpt::obs::CObservation2DRangeScan &rangeScan, const mrpt::poses::CPose3D *robotPose=nullptr) override
See CPointsMap::loadFromRangeScan() 
virtual 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. 
virtual 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...
virtual ~TColourOptions()
GLsizei GLsizei GLchar * source
void resize(const size_t N)
Set number of points (to uninitialized values) 
A RGB color - floats in the range [0,1]. 
size_t size() const
Get number of points. 
std::vector< float > m_color_R
The color data. 
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. 
The definition of parameters for generating colors from laser scans. 
virtual void insertPoint(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]) 
An adapter to different kinds of point cloud object. 
virtual void getAs3DObject(mrpt::opengl::CSetOfObjects::Ptr &outObj) const override
Override of the default 3D scene builder to account for the individual points' color. 
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. ...
size_t size() const
Returns the number of stored points in the map. 
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]) 
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...
float coords_t
The type of each point XYZ coordinates. 
static void fill(bimap< enum_t, std::string > &m_map)
void setPointColor(size_t index, float R, float G, float B)
Changes just the color of a given point from the map.