Main MRPT website > C++ reference
MRPT logo
Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
mrpt::slam::CColouredPointsMap Class Reference

Detailed Description

A map of 2D/3D points with individual colours (RGB).

For different color schemes, see CColouredPointsMap::colorScheme Colors are defined in the range [0,1].

See also:
mrpt::slam::CPointsMap, mrpt::slam::CMetricMap, mrpt::utils::CSerializable

#include <mrpt/slam/CColouredPointsMap.h>

Inheritance diagram for mrpt::slam::CColouredPointsMap:
Inheritance graph
[legend]

List of all members.

Classes

struct  TColourOptions
 The definition of parameters for generating colors from laser scans. More...

Public Types

enum  TColouringMethod { cmFromHeightRelativeToSensor = 0, cmFromHeightRelativeToSensorJet = 0, cmFromHeightRelativeToSensorGray = 1, cmFromIntensityImage = 2 }
 The choices for coloring schemes: More...

Public Member Functions

virtual ~CColouredPointsMap ()
 Destructor.
 CColouredPointsMap ()
 Default constructor.
bool save3D_and_colour_to_text_file (const std::string &file) const
 Save to a text file.
virtual void setPoint (size_t index, float x, float y, float z, float R, float G, float B)
 Changes a given point from map.
void setPoint (size_t index, float x, float y, float z)
void setPoint (size_t index, CPoint2D &p)
void setPoint (size_t index, CPoint3D &p)
void setPoint (size_t index, float x, float y)
virtual void insertPoint (float x, float y, float z, float R, float G, float B)
 Adds a new point given its coordinates and color (colors range is [0,1])
void insertPoint (const CPoint3D &p)
void insertPoint (const mrpt::math::TPoint3D &p)
void insertPoint (float x, float y, float z)
void setPointColor (size_t index, float R, float G, float B)
 Changes just the color of a given point from the map.
virtual void getPoint (size_t index, float &x, float &y, float &z, float &R, float &G, float &B) const
 Retrieves a point and its color (colors range is [0,1])
unsigned long getPoint (size_t index, float &x, float &y, float &z) const
 Retrieves a point.
void getPointColor (size_t index, float &R, float &G, float &B) const
 Retrieves a point color (colors range is [0,1])
virtual bool hasColorPoints () const
 Returns true if the point map has a color field for each point.
virtual void getAs3DObject (mrpt::opengl::CSetOfObjectsPtr &outObj) const
 Override of the default 3D scene builder to account for the individual points' color.
bool colourFromObservation (const CObservationImage &obs, const CPose3D &robotPose)
 Colour a set of points from a CObservationImage and the global pose of the robot.
void resetPointsMinDist (float defValue=2000.0f)
 Reset the minimum-observed-distance buffer for all the points to a predefined value.
PCL library support
virtual bool savePCDFile (const std::string &filename, bool save_as_binary) const
 Save the point cloud as a PCL PCD file, in either ASCII or binary format.

Public Attributes

TColourOptions colorScheme
 The options employed when inserting laser scans in the map.

Protected Member Functions

virtual void internal_clear ()
 Minimum distance from where the points have been seen.
Redefinition of PLY Import virtual methods from CPointsMap
virtual void PLY_import_set_vertex (const size_t idx, const mrpt::math::TPoint3Df &pt, const mrpt::utils::TColorf *pt_color=NULL)
 In a base class, will be called after PLY_import_set_vertex_count() once for each loaded point.
virtual void PLY_import_set_vertex_count (const size_t N)
 In a base class, reserve memory to prepare subsequent calls to PLY_import_set_vertex.
Redefinition of PLY Export virtual methods from CPointsMap
virtual void PLY_export_get_vertex (const size_t idx, mrpt::math::TPoint3Df &pt, bool &pt_has_color, mrpt::utils::TColorf &pt_color) const
 In a base class, will be called after PLY_export_get_vertex_count() once for each exported point.

Protected Attributes

std::vector< float > m_color_R
 The color data.
std::vector< float > m_color_G
std::vector< float > m_color_B

RTTI stuff

typedef CColouredPointsMapPtr SmartPtr
static mrpt::utils::CLASSINIT _init_CColouredPointsMap
static mrpt::utils::TRuntimeClassId classCColouredPointsMap
static const
mrpt::utils::TRuntimeClassId * 
classinfo
static const
mrpt::utils::TRuntimeClassId * 
_GetBaseClass ()
virtual const
mrpt::utils::TRuntimeClassId * 
GetRuntimeClass () const
 Returns information about the class of an object in runtime.
virtual mrpt::utils::CObject * duplicate () const
 Returns a copy of the object, indepently of its class.
static mrpt::utils::CObject * CreateObject ()
static CColouredPointsMapPtr Create ()

Pure virtual interfaces to be implemented by any class derived from CPointsMap

struct detail::loadFromRangeImpl
struct detail::pointmap_traits
virtual void reserve (size_t newLength)
 Reserves memory for a given number of points: the size of the map does not change, it only reserves the memory.
virtual void resize (size_t newLength)
 Resizes all point buffers so they can hold the given number of points: newly created points are set to default values, and old contents are not changed.
virtual void setSize (size_t newLength)
 Resizes all point buffers so they can hold the given number of points, *erasing* all previous contents and leaving all points to default values.
virtual 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 *without* calling mark_as_modified()
virtual void insertPointFast (float x, float y, float z=0)
 The virtual method for insertPoint() *without* calling mark_as_modified()
virtual void copyFrom (const CPointsMap &obj)
 Virtual assignment operator, to be implemented in derived classes.
virtual void getPointAllFieldsFast (const size_t index, std::vector< float > &point_data) const
 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 setPointAllFieldsFast (const size_t index, const std::vector< float > &point_data)
 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 loadFromRangeScan (const CObservation2DRangeScan &rangeScan, const CPose3D *robotPose=NULL)
 See CPointsMap::loadFromRangeScan()
virtual void loadFromRangeScan (const CObservation3DRangeScan &rangeScan, const CPose3D *robotPose=NULL)
 See CPointsMap::loadFromRangeScan()
virtual void addFrom_classSpecific (const CPointsMap &anotherMap, const size_t nPreviousPoints)
 Auxiliary method called from within addFrom() automatically, to finish the copying of class-specific data.

Member Typedef Documentation

A typedef for the associated smart pointer

Definition at line 58 of file CColouredPointsMap.h.


Member Enumeration Documentation

The choices for coloring schemes:

  • cmFromHeightRelativeToSensor: The Z coordinate wrt the sensor will be used to obtain the color using the limits z_min,z_max.

cmFromIntensityImage: When inserting 3D range scans, take the color from the intensity image channel, if available.

See also:
TColourOptions
Enumerator:
cmFromHeightRelativeToSensor 
cmFromHeightRelativeToSensorJet 
cmFromHeightRelativeToSensorGray 
cmFromIntensityImage 

Definition at line 222 of file CColouredPointsMap.h.


Constructor & Destructor Documentation

virtual mrpt::slam::CColouredPointsMap::~CColouredPointsMap ( ) [virtual]

Destructor.

mrpt::slam::CColouredPointsMap::CColouredPointsMap ( )

Default constructor.


Member Function Documentation

static const mrpt::utils::TRuntimeClassId* mrpt::slam::CColouredPointsMap::_GetBaseClass ( ) [static, protected]

Reimplemented from mrpt::slam::CPointsMap.

virtual void mrpt::slam::CColouredPointsMap::addFrom_classSpecific ( const CPointsMap &  anotherMap,
const size_t  nPreviousPoints 
) [protected, virtual]

Auxiliary method called from within addFrom() automatically, to finish the copying of class-specific data.

Implements mrpt::slam::CPointsMap.

bool mrpt::slam::CColouredPointsMap::colourFromObservation ( const CObservationImage &  obs,
const CPose3D &  robotPose 
)

Colour a set of points from a CObservationImage and the global pose of the robot.

virtual void mrpt::slam::CColouredPointsMap::copyFrom ( const CPointsMap &  obj) [virtual]

Virtual assignment operator, to be implemented in derived classes.

Implements mrpt::slam::CPointsMap.

static CColouredPointsMapPtr mrpt::slam::CColouredPointsMap::Create ( ) [static]
static mrpt::utils::CObject* mrpt::slam::CColouredPointsMap::CreateObject ( ) [static]
virtual mrpt::utils::CObject* mrpt::slam::CColouredPointsMap::duplicate ( ) const [virtual]

Returns a copy of the object, indepently of its class.

Implements mrpt::utils::CObject.

virtual void mrpt::slam::CColouredPointsMap::getAs3DObject ( mrpt::opengl::CSetOfObjectsPtr &  outObj) const [virtual]

Override of the default 3D scene builder to account for the individual points' color.

See also:
mrpt::global_settings::POINTSMAPS_3DOBJECT_POINTSIZE

Reimplemented from mrpt::slam::CPointsMap.

virtual void mrpt::slam::CColouredPointsMap::getPoint ( size_t  index,
float &  x,
float &  y,
float &  z,
float &  R,
float &  G,
float &  B 
) const [virtual]

Retrieves a point and its color (colors range is [0,1])

Reimplemented from mrpt::slam::CPointsMap.

unsigned long mrpt::slam::CColouredPointsMap::getPoint ( size_t  index,
float &  x,
float &  y,
float &  z 
) const

Retrieves a point.

Reimplemented from mrpt::slam::CPointsMap.

virtual void mrpt::slam::CColouredPointsMap::getPointAllFieldsFast ( const size_t  index,
std::vector< float > &  point_data 
) const [inline, virtual]

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.

See also:
getPointAllFields, setPointAllFields, setPointAllFieldsFast

Implements mrpt::slam::CPointsMap.

Definition at line 105 of file CColouredPointsMap.h.

void mrpt::slam::CColouredPointsMap::getPointColor ( size_t  index,
float &  R,
float &  G,
float &  B 
) const

Retrieves a point color (colors range is [0,1])

virtual const mrpt::utils::TRuntimeClassId* mrpt::slam::CColouredPointsMap::GetRuntimeClass ( ) const [virtual]

Returns information about the class of an object in runtime.

Reimplemented from mrpt::slam::CPointsMap.

virtual bool mrpt::slam::CColouredPointsMap::hasColorPoints ( ) const [inline, virtual]

Returns true if the point map has a color field for each point.

Reimplemented from mrpt::slam::CPointsMap.

Definition at line 206 of file CColouredPointsMap.h.

virtual void mrpt::slam::CColouredPointsMap::insertPoint ( float  x,
float  y,
float  z,
float  R,
float  G,
float  B 
) [virtual]

Adds a new point given its coordinates and color (colors range is [0,1])

Reimplemented from mrpt::slam::CPointsMap.

void mrpt::slam::CColouredPointsMap::insertPoint ( const CPoint3D &  p) [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Reimplemented from mrpt::slam::CPointsMap.

Definition at line 184 of file CColouredPointsMap.h.

References insertPoint().

Referenced by insertPoint().

void mrpt::slam::CColouredPointsMap::insertPoint ( const mrpt::math::TPoint3D &  p) [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Reimplemented from mrpt::slam::CPointsMap.

Definition at line 186 of file CColouredPointsMap.h.

References insertPoint(), mrpt::math::TPoint3D::x, mrpt::math::TPoint3D::y, and mrpt::math::TPoint3D::z.

Referenced by insertPoint().

void mrpt::slam::CColouredPointsMap::insertPoint ( float  x,
float  y,
float  z 
) [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Reimplemented from mrpt::slam::CPointsMap.

Definition at line 188 of file CColouredPointsMap.h.

virtual void mrpt::slam::CColouredPointsMap::insertPointFast ( float  x,
float  y,
float  z = 0 
) [virtual]

The virtual method for insertPoint() *without* calling mark_as_modified()

Implements mrpt::slam::CPointsMap.

virtual void mrpt::slam::CColouredPointsMap::internal_clear ( ) [protected, virtual]

Minimum distance from where the points have been seen.

Clear the map, erasing all the points.

Implements mrpt::slam::CMetricMap.

virtual void mrpt::slam::CColouredPointsMap::loadFromRangeScan ( const CObservation2DRangeScan &  rangeScan,
const CPose3D *  robotPose = NULL 
) [virtual]
virtual void mrpt::slam::CColouredPointsMap::loadFromRangeScan ( const CObservation3DRangeScan &  rangeScan,
const CPose3D *  robotPose = NULL 
) [virtual]
virtual void mrpt::slam::CColouredPointsMap::PLY_export_get_vertex ( const size_t  idx,
mrpt::math::TPoint3Df &  pt,
bool &  pt_has_color,
mrpt::utils::TColorf &  pt_color 
) const [protected, virtual]

In a base class, will be called after PLY_export_get_vertex_count() once for each exported point.

Parameters:
pt_colorWill be NULL if the loaded file does not provide color info.

Reimplemented from mrpt::slam::CPointsMap.

virtual void mrpt::slam::CColouredPointsMap::PLY_import_set_vertex ( const size_t  idx,
const mrpt::math::TPoint3Df &  pt,
const mrpt::utils::TColorf *  pt_color = NULL 
) [protected, virtual]

In a base class, will be called after PLY_import_set_vertex_count() once for each loaded point.

Parameters:
pt_colorWill be NULL if the loaded file does not provide color info.

Reimplemented from mrpt::slam::CPointsMap.

virtual void mrpt::slam::CColouredPointsMap::PLY_import_set_vertex_count ( const size_t  N) [protected, virtual]

In a base class, reserve memory to prepare subsequent calls to PLY_import_set_vertex.

Implements mrpt::utils::PLY_Importer.

virtual void mrpt::slam::CColouredPointsMap::reserve ( size_t  newLength) [virtual]

Reserves memory for a given number of points: the size of the map does not change, it only reserves the memory.

This is useful for situations where it is approximately known the final size of the map. This method is more efficient than constantly increasing the size of the buffers. Refer to the STL C++ library's "reserve" methods.

Implements mrpt::slam::CPointsMap.

void mrpt::slam::CColouredPointsMap::resetPointsMinDist ( float  defValue = 2000.0f)

Reset the minimum-observed-distance buffer for all the points to a predefined value.

virtual void mrpt::slam::CColouredPointsMap::resize ( size_t  newLength) [virtual]

Resizes all point buffers so they can hold the given number of points: newly created points are set to default values, and old contents are not changed.

See also:
reserve, setPoint, setPointFast, setSize

Implements mrpt::slam::CPointsMap.

bool mrpt::slam::CColouredPointsMap::save3D_and_colour_to_text_file ( const std::string &  file) const

Save to a text file.

In each line contains X Y Z (meters) R G B (range [0,1]) for each point in the map. Returns false if any error occured, true elsewere.

virtual bool mrpt::slam::CColouredPointsMap::savePCDFile ( const std::string &  filename,
bool  save_as_binary 
) const [virtual]

Save the point cloud as a PCL PCD file, in either ASCII or binary format.

Returns:
false on any error

Reimplemented from mrpt::slam::CPointsMap.

virtual void mrpt::slam::CColouredPointsMap::setPoint ( size_t  index,
float  x,
float  y,
float  z,
float  R,
float  G,
float  B 
) [virtual]

Changes a given point from map.

First index is 0.

Exceptions:
Throwsstd::exception on index out of bound.

Reimplemented from mrpt::slam::CPointsMap.

void mrpt::slam::CColouredPointsMap::setPoint ( size_t  index,
float  x,
float  y,
float  z 
) [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Reimplemented from mrpt::slam::CPointsMap.

Definition at line 167 of file CColouredPointsMap.h.

References ASSERT_BELOW_, and mrpt::math::size().

void mrpt::slam::CColouredPointsMap::setPoint ( size_t  index,
CPoint2D &  p 
) [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Reimplemented from mrpt::slam::CPointsMap.

Definition at line 173 of file CColouredPointsMap.h.

References setPoint().

Referenced by setPoint().

void mrpt::slam::CColouredPointsMap::setPoint ( size_t  index,
CPoint3D &  p 
) [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Reimplemented from mrpt::slam::CPointsMap.

Definition at line 175 of file CColouredPointsMap.h.

References setPoint().

Referenced by setPoint().

void mrpt::slam::CColouredPointsMap::setPoint ( size_t  index,
float  x,
float  y 
) [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Reimplemented from mrpt::slam::CPointsMap.

Definition at line 177 of file CColouredPointsMap.h.

References setPoint().

Referenced by setPoint().

virtual void mrpt::slam::CColouredPointsMap::setPointAllFieldsFast ( const size_t  index,
const std::vector< float > &  point_data 
) [inline, virtual]

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.

See also:
setPointAllFields, getPointAllFields, getPointAllFieldsFast

Implements mrpt::slam::CPointsMap.

Definition at line 119 of file CColouredPointsMap.h.

References ASSERTDEB_, and Eigen::internal::y.

void mrpt::slam::CColouredPointsMap::setPointColor ( size_t  index,
float  R,
float  G,
float  B 
)

Changes just the color of a given point from the map.

First index is 0.

Exceptions:
Throwsstd::exception on index out of bound.
virtual void mrpt::slam::CColouredPointsMap::setPointFast ( size_t  index,
float  x,
float  y,
float  z 
) [virtual]

Changes the coordinates of the given point (0-based index), *without* checking for out-of-bounds and *without* calling mark_as_modified()

See also:
setPoint

Implements mrpt::slam::CPointsMap.

virtual void mrpt::slam::CColouredPointsMap::setSize ( size_t  newLength) [virtual]

Resizes all point buffers so they can hold the given number of points, *erasing* all previous contents and leaving all points to default values.

See also:
reserve, setPoint, setPointFast, setSize

Implements mrpt::slam::CPointsMap.


Friends And Related Function Documentation

friend struct detail::loadFromRangeImpl [friend]

Reimplemented from mrpt::slam::CPointsMap.

Definition at line 146 of file CColouredPointsMap.h.

friend struct detail::pointmap_traits [friend]

Reimplemented from mrpt::slam::CPointsMap.

Definition at line 147 of file CColouredPointsMap.h.


Member Data Documentation

Definition at line 58 of file CColouredPointsMap.h.

Definition at line 58 of file CColouredPointsMap.h.

Definition at line 58 of file CColouredPointsMap.h.

The options employed when inserting laser scans in the map.

Definition at line 251 of file CColouredPointsMap.h.

Definition at line 266 of file CColouredPointsMap.h.

Definition at line 266 of file CColouredPointsMap.h.

The color data.

Definition at line 266 of file CColouredPointsMap.h.




Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Sun Oct 16 12:16:33 UTC 2011