Go to the documentation of this file.
9 #ifndef CColouredPointsMap_H
10 #define CColouredPointsMap_H
72 virtual
void getPointAllFieldsFast( const
size_t index, std::vector<
float> & point_data ) const
MRPT_OVERRIDE {
74 point_data[0] = x[index];
75 point_data[1] = y[index];
76 point_data[2] = 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];
88 x[index] = point_data[0];
89 y[index] = point_data[1];
90 z[index] = point_data[2];
91 m_color_R[index] = point_data[3];
92 m_color_G[index] = point_data[4];
93 m_color_B[index] = point_data[5];
125 inline void setPoint(
size_t index,
float x,
float y,
float z) {
127 setPointFast(index,x,y,z);
146 inline void insertPoint(
float x,
float y,
float z) { insertPointFast(x,y,z); mark_as_modified(); }
156 this->m_color_R[index]=R;
157 this->m_color_G[index]=G;
158 this->m_color_B[index]=B;
163 virtual void getPoint(
size_t index,
float &x,
float &y,
float &z,
float &R,
float &G,
float &B )
const MRPT_OVERRIDE;
166 unsigned long getPoint(
size_t index,
float &x,
float &y,
float &z)
const;
174 R = m_color_R[index];
175 G = m_color_G[index];
176 B = m_color_B[index];
197 cmFromHeightRelativeToSensor = 0,
198 cmFromHeightRelativeToSensorJet = 0,
199 cmFromHeightRelativeToSensorGray = 1,
200 cmFromIntensityImage = 2
238 template <
class POINTCLOUD>
241 const size_t N = cloud.points.size();
244 const float f = 1.0f/255.0f;
245 for (
size_t i=0;i<N;++i)
246 this->insertPoint(cloud.points[i].x,cloud.points[i].y,cloud.points[i].z,cloud.points[i].r*f,cloud.points[i].g*f,cloud.points[i].b*f);
250 template <
class POINTCLOUD>
253 const size_t nThis = this->
size();
254 this->getPCLPointCloud(cloud);
256 for (
size_t i = 0; i < nThis; ++i) {
258 this->getPointColor_fast(i,R,G,B);
259 cloud.points[i].r =
static_cast<uint8_t
>(R*255);
260 cloud.points[i].g =
static_cast<uint8_t
>(G*255);
261 cloud.points[i].b =
static_cast<uint8_t
>(B*255);
281 virtual
void PLY_import_set_vertex(const
size_t idx, const
mrpt::math::TPoint3Df &pt, const
mrpt::utils::TColorf *pt_color = NULL)
MRPT_OVERRIDE;
289 void PLY_export_get_vertex(const
size_t idx,
mrpt::math::TPoint3Df &pt,
bool &pt_has_color,
mrpt::utils::TColorf &pt_color) const
MRPT_OVERRIDE;
303 #include <mrpt/utils/adapters.h>
314 static const int HAS_RGB = 1;
315 static const int HAS_RGBf = 1;
316 static const int HAS_RGBu8 = 0;
321 inline size_t size()
const {
return m_obj.
size(); }
326 template <
typename T>
327 inline void getPointXYZ(
const size_t idx, T &x,T &y, T &z)
const {
336 template <
typename T>
337 inline void getPointXYZ_RGBf(
const size_t idx, T &x,T &y, T &z,
float &r,
float &g,
float &b)
const {
346 template <
typename T>
347 inline void getPointXYZ_RGBu8(
const size_t idx, T &x,T &y, T &z, uint8_t &r,uint8_t &g,uint8_t &b)
const {
350 r=Rf*255; g=Gf*255; b=Bf*255;
354 m_obj.
setPoint(idx,x,y,z,r/255.f,g/255.f,b/255.f);
363 inline void getPointRGBu8(
const size_t idx, uint8_t &r,uint8_t &g,uint8_t &b)
const {
366 r=R*255; g=G*255; b=B*255;
369 inline void setPointRGBu8(
const size_t idx,
const uint8_t r,
const uint8_t g,
const uint8_t b) {
Lightweight 3D point (float version).
An adapter to different kinds of point cloud object.
std::vector< float > m_color_R
The color data.
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.
virtual void resize(size_t newLength) MRPT_OVERRIDE
Resizes all point buffers so they can hold the given number of points: newly created points are set t...
mrpt::maps::CColouredPointsMap & m_obj
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.
size_t size() const
Returns the number of stored points in the map.
Options used when evaluating "computeObservationLikelihood" in the derived classes.
A map of 2D/3D points with individual colours (RGB).
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 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,...
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string §ion) MRPT_OVERRIDE
This method load the options from a ".ini"-like file or memory-stored string list.
TColourOptions colorScheme
The options employed when inserting laser scans in the map.
#define MAP_DEFINITION_END(_CLASS_NAME_, _LINKAGE_)
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
With this struct options are provided to the observation insertion process.
void setPointColor_fast(size_t index, float R, float G, float B)
Like setPointColor but without checking for out-of-index erors.
virtual void getAs3DObject(mrpt::opengl::CSetOfObjectsPtr &outObj) const MRPT_OVERRIDE
Override of the default 3D scene builder to account for the individual points' color.
double z
X,Y,Z coordinates.
void getPointRGBu8(const size_t idx, uint8_t &r, uint8_t &g, uint8_t &b) const
Get RGBu8 color of i'th point.
size_t size(const MATRIXLIKE &m, int dim)
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.
bool save3D_and_colour_to_text_file(const std::string &file) const
Save to a text file.
virtual ~CColouredPointsMap()
Destructor.
virtual void insertPoint(float x, float y, float z, float R, float G, float B) MRPT_OVERRIDE
Adds a new point given its coordinates and color (colors range is [0,1])
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans or other sensors.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
virtual void setPointAllFieldsFast(const size_t index, const std::vector< float > &point_data) MRPT_OVERRIDE
Set all the data fields for one point as a vector: [X Y Z R G B] Unlike setPointAllFields(),...
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.
#define ASSERT_BELOW_(__A, __B)
void getPCLPointCloudXYZRGB(POINTCLOUD &cloud) const
Like CPointsMap::getPCLPointCloud() but for PointCloud<PointXYZRGB>
void insertPoint(const mrpt::math::TPoint3D &p)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void getPointXYZ(const size_t idx, T &x, T &y, T &z) const
Get XYZ coordinates of i'th point.
virtual void loadFromRangeScan(const mrpt::obs::CObservation3DRangeScan &rangeScan, const mrpt::poses::CPose3D *robotPose=NULL) MRPT_OVERRIDE
See CPointsMap::loadFromRangeScan()
void setPointRGBf(const size_t idx, const float r, const float g, const float b)
Set XYZ_RGBf coordinates of i'th point.
#define MAP_DEFINITION_START(_CLASS_NAME_, _LINKAGE_)
Add a MAP_DEFINITION_START() ...
virtual void internal_clear() MRPT_OVERRIDE
Minimum distance from where the points have been seen.
#define ASSERTDEB_(f)
Defines an assertion mechanism - only when compiled in debug.
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 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.
Declares a class derived from "CObservation" that encapsules a 3D range scan measurement,...
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
void setPoint(size_t index, mrpt::math::TPoint3Df &p)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void insertPoint(float x, float y, float z)
This is an overloaded member function, provided for convenience. It differs from the above function o...
This class allows loading and storing values and vectors of different types from a configuration text...
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...
unsigned long getPoint(size_t index, float &x, float &y, float &z) const
Retrieves a point
double x() const
Common members of all points & poses classes.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
TColourOptions()
Initilization of default parameters.
virtual void setPoint(size_t index, float x, float y, float z, float R, float G, float B) MRPT_OVERRIDE
Changes a given point from map.
virtual bool hasColorPoints() const MRPT_OVERRIDE
Returns true if the point map has a color field for each point.
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
virtual ~TColourOptions()
void dumpToTextStream(mrpt::utils::CStream &out) const MRPT_OVERRIDE
This method should clearly display all the contents of the structure in textual form,...
virtual void setPointFast(size_t index, float x, float y, float z) MRPT_OVERRIDE
Changes the coordinates of the given point (0-based index), without checking for out-of-bounds and wi...
void getPointRGBf(const size_t idx, float &r, float &g, float &b) const
Get RGBf color of i'th point.
virtual void loadFromRangeScan(const mrpt::obs::CObservation2DRangeScan &rangeScan, const mrpt::poses::CPose3D *robotPose=NULL) MRPT_OVERRIDE
See CPointsMap::loadFromRangeScan()
The definition of parameters for generating colors from laser scans.
TColouringMethod
The choices for coloring schemes:
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
virtual bool savePCDFile(const std::string &filename, bool save_as_binary) const MRPT_OVERRIDE
Save the point cloud as a PCL PCD file, in either ASCII or binary format.
void setPoint(size_t index, float x, float y)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void insertPoint(const mrpt::poses::CPoint3D &p)
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
PointCloudAdapter(const mrpt::maps::CColouredPointsMap &obj)
Constructor (accept a const ref for convenience)
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.
virtual void setSize(size_t newLength) MRPT_OVERRIDE
Resizes all point buffers so they can hold the given number of points, erasing all previous contents ...
virtual void reserve(size_t newLength) MRPT_OVERRIDE
Reserves memory for a given number of points: the size of the map does not change,...
virtual void getPoint(size_t index, float &x, float &y, float &z, float &R, float &G, float &B) const MRPT_OVERRIDE
Retrieves a point and its color (colors range is [0,1])
virtual void insertPointFast(float x, float y, float z=0) MRPT_OVERRIDE
The virtual method for insertPoint() without calling mark_as_modified()
void getPointColor_fast(size_t index, float &R, float &G, float &B) const
Like getPointColor but without checking for out-of-index erors.
void insertPoint(const mrpt::math::TPoint3Df &p)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setPointColor(size_t index, float R, float G, float B)
Changes just the color of a given point from the map.
void resize(const size_t N)
Set number of points (to uninitialized values)
A class used to store a 3D point.
void setPoint(size_t index, float x, float y, float z)
This is an overloaded member function, provided for convenience. It differs from the above function o...
size_t size() const
Get number of points.
void getPointColor(size_t index, float &R, float &G, float &B) const
Retrieves a point color (colors range is [0,1])
Declares a class derived from "CObservation" that encapsules an image from a camera,...
CColouredPointsMap()
Default constructor.
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
virtual void addFrom_classSpecific(const CPointsMap &anotherMap, const size_t nPreviousPoints) MRPT_OVERRIDE
Auxiliary method called from within addFrom() automatically, to finish the copying of class-specific ...
void resetPointsMinDist(float defValue=2000.0f)
Reset the minimum-observed-distance buffer for all the points to a predefined value.
Page generated by Doxygen 1.8.20 for MRPT 1.4.0 SVN: at Thu Aug 27 02:40:23 UTC 2020 | | |