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].
Definition at line 52 of file CColouredPointsMap.h.
#include <mrpt/slam/CColouredPointsMap.h>
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:
| |
Public Member Functions | |
virtual | ~CColouredPointsMap () |
Destructor. | |
CColouredPointsMap () | |
Default constructor. | |
void | copyFrom (const CPointsMap &obj) |
Copy operator. | |
void | loadFromRangeScan (const CObservation2DRangeScan &rangeScan, const CPose3D *robotPose=NULL) |
Transform the range scan into a set of cartessian coordinated points. | |
void | loadFromRangeScan (const CObservation3DRangeScan &rangeScan, const CPose3D *robotPose=NULL) |
Transform the range scan into a set of cartessian coordinated points. | |
bool | load2D_from_text_file (std::string file) |
Load from a text file. | |
bool | load3D_from_text_file (std::string file) |
Load from a text file. | |
bool | save3D_and_colour_to_text_file (const std::string &file) const |
Save to a text file. | |
void | fuseWith (CPointsMap *otherMap, float minDistForFuse=0.02f, std::vector< bool > *notFusedPoints=NULL) |
Insert the contents of another map into this one, fusing the previous content with the new one. | |
virtual void | setPoint (size_t index, CPoint2D &p) |
Changes a given point from map, as a 2D point. | |
virtual void | setPoint (size_t index, CPoint3D &p) |
Changes a given point from map, as a 3D point. | |
virtual void | setPoint (size_t index, float x, float y) |
Changes a given point from map. | |
virtual void | setPoint (size_t index, float x, float y, float z) |
Changes a given point from map. | |
void | setPoint (size_t index, float x, float y, float z, float R, float G, float B) |
Changes a given point from map. | |
void | setPointColor (size_t index, float R, float G, float B) |
Changes just the color of a given point from the map. | |
void | insertPoint (float x, float y, float z=0) |
Provides a way to insert individual points into the map: | |
void | insertPoint (CPoint3D p) |
Provides a way to insert individual points into the map: | |
void | applyDeletionMask (std::vector< bool > &mask) |
Remove from the map the points marked in a bool's array as "true". | |
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]) | |
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]) | |
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. | |
void | auxParticleFilterCleanUp () |
This method is called at the end of each "prediction-update-map insertion" cycle within "mrpt::slam::CMetricMapBuilderRBPF::processActionObservation". | |
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. | |
template<typename VECTOR > | |
void | setAllPointsTemplate (const VECTOR &X, const VECTOR &Y, const VECTOR &Z=VECTOR()) |
Set all the points at once from vectors with X,Y and Z coordinates (if Z is not provided, it will be set to all zeros). | |
virtual void | setAllPoints (const std::vector< float > &X, const std::vector< float > &Y, const std::vector< float > &Z) |
Set all the points at once from vectors with X,Y and Z coordinates. | |
virtual void | setAllPoints (const std::vector< float > &X, const std::vector< float > &Y) |
Set all the points at once from vectors with X and Y coordinates (Z=0). | |
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. | |
Public Attributes | |
TColourOptions | colorScheme |
The options employed when inserting laser scans in the map. | |
Protected Member Functions | |
virtual void | internal_clear () |
Clear the map, erasing all the points. | |
virtual bool | internal_insertObservation (const CObservation *obs, const CPose3D *robotPose=NULL) |
Insert the observation information into this map. | |
Protected Attributes | |
std::vector< float > | m_color_R |
The color data. | |
std::vector< float > | m_color_G |
std::vector< float > | m_color_B |
std::vector< float > | m_min_dist |
Minimum distance from where the points have been seen. | |
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 () |
Filter-by-height stuff | |
double | z_min |
The minimum and maximum height for a certain laser scan to be inserted into this map. | |
double | z_max |
bool | bFilterByHeight |
Whether or not filter the input points by height. | |
void | enableFilterByHeight (bool enable=true) |
Enable/disable the filter-by-height functionality. | |
bool | isFilterByHeightEnabled () const |
Return whether filter-by-height is enabled. | |
void | setHeightFilterLevels (const double _z_min, const double _z_max) |
Set the min/max Z levels for points to be actually inserted in the map (only if enableFilterByHeight() was called before). | |
void | getHeightFilterLevels (double &_z_min, double &_z_max) const |
Get the min/max Z levels for points to be actually inserted in the map. |
A typedef for the associated smart pointer
Definition at line 55 of file CColouredPointsMap.h.
The choices for coloring schemes:
cmFromHeightRelativeToSensor | |
cmFromHeightRelativeToSensorJet | |
cmFromHeightRelativeToSensorGray | |
cmFromIntensityImage |
Definition at line 262 of file CColouredPointsMap.h.
virtual mrpt::slam::CColouredPointsMap::~CColouredPointsMap | ( | ) | [virtual] |
Destructor.
mrpt::slam::CColouredPointsMap::CColouredPointsMap | ( | ) |
Default constructor.
static const mrpt::utils::TRuntimeClassId* mrpt::slam::CColouredPointsMap::_GetBaseClass | ( | ) | [static, protected] |
Reimplemented from mrpt::slam::CPointsMap.
void mrpt::slam::CColouredPointsMap::applyDeletionMask | ( | std::vector< bool > & | mask | ) | [virtual] |
Remove from the map the points marked in a bool's array as "true".
std::exception | If mask size is not equal to points count. |
Implements mrpt::slam::CPointsMap.
void mrpt::slam::CColouredPointsMap::auxParticleFilterCleanUp | ( | ) | [virtual] |
This method is called at the end of each "prediction-update-map insertion" cycle within "mrpt::slam::CMetricMapBuilderRBPF::processActionObservation".
This method should normally do nothing, but in some cases can be used to free auxiliary cached variables.
Implements mrpt::slam::CMetricMap.
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.
void mrpt::slam::CColouredPointsMap::copyFrom | ( | const CPointsMap & | obj | ) | [virtual] |
Copy operator.
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.
void mrpt::slam::CColouredPointsMap::enableFilterByHeight | ( | bool | enable = true | ) | [inline] |
Enable/disable the filter-by-height functionality.
Definition at line 299 of file CColouredPointsMap.h.
void mrpt::slam::CColouredPointsMap::fuseWith | ( | CPointsMap * | otherMap, |
float | minDistForFuse = 0.02f , |
||
std::vector< bool > * | notFusedPoints = NULL |
||
) | [virtual] |
Insert the contents of another map into this one, fusing the previous content with the new one.
This means that points very close to existing ones will be "fused", rather than "added". This prevents the unbounded increase in size of these class of maps. NOTICE that "otherMap" is neither translated nor rotated here, so if this is desired it must done before calling this method.
otherMap | The other map whose points are to be inserted into this one. |
minDistForFuse | Minimum distance (in meters) between two points, each one in a map, to be considered the same one and be fused rather than added. |
notFusedPoints | If a pointer is supplied, this list will contain at output a list with a "bool" value per point in "this" map. This will be false/true according to that point having been fused or not. |
Implements mrpt::slam::CPointsMap.
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.
Reimplemented from mrpt::slam::CPointsMap.
void mrpt::slam::CColouredPointsMap::getHeightFilterLevels | ( | double & | _z_min, |
double & | _z_max | ||
) | const [inline] |
Get the min/max Z levels for points to be actually inserted in the map.
Definition at line 306 of file CColouredPointsMap.h.
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.
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 200 of file CColouredPointsMap.h.
void mrpt::slam::CColouredPointsMap::insertPoint | ( | float | x, |
float | y, | ||
float | z = 0 |
||
) | [virtual] |
Provides a way to insert individual points into the map:
Implements mrpt::slam::CPointsMap.
void mrpt::slam::CColouredPointsMap::insertPoint | ( | CPoint3D | p | ) |
Provides a way to insert individual points into the map:
void mrpt::slam::CColouredPointsMap::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])
virtual void mrpt::slam::CColouredPointsMap::internal_clear | ( | ) | [protected, virtual] |
Clear the map, erasing all the points.
Implements mrpt::slam::CMetricMap.
virtual bool mrpt::slam::CColouredPointsMap::internal_insertObservation | ( | const CObservation * | obs, |
const CPose3D * | robotPose = NULL |
||
) | [protected, virtual] |
Insert the observation information into this map.
This method must be implemented in derived classes.
obs | The observation |
robotPose | The 3D pose of the robot mobile base in the map reference system, or NULL (default) if you want to use CPose2D(0,0,deg) |
Implements mrpt::slam::CMetricMap.
bool mrpt::slam::CColouredPointsMap::isFilterByHeightEnabled | ( | ) | const [inline] |
Return whether filter-by-height is enabled.
Definition at line 301 of file CColouredPointsMap.h.
bool mrpt::slam::CColouredPointsMap::load2D_from_text_file | ( | std::string | file | ) | [virtual] |
Load from a text file.
In each line there are a point coordinates. Returns false if any error occured, true elsewere.
Implements mrpt::slam::CPointsMap.
bool mrpt::slam::CColouredPointsMap::load3D_from_text_file | ( | std::string | file | ) | [virtual] |
Load from a text file.
In each line there are a point coordinates. Returns false if any error occured, true elsewere.
Implements mrpt::slam::CPointsMap.
void mrpt::slam::CColouredPointsMap::loadFromRangeScan | ( | const CObservation3DRangeScan & | rangeScan, |
const CPose3D * | robotPose = NULL |
||
) |
Transform the range scan into a set of cartessian coordinated points.
The options in "insertionOptions" are considered in this method.
rangeScan | The scan to be inserted into this map |
robotPose | The robot 3D pose, default to (0,0,0|0deg,0deg,0deg). It is used to compute the sensor pose relative to the robot actual pose. Recall sensor pose is embeded in the observation class. |
void mrpt::slam::CColouredPointsMap::loadFromRangeScan | ( | const CObservation2DRangeScan & | rangeScan, |
const CPose3D * | robotPose = NULL |
||
) | [virtual] |
Transform the range scan into a set of cartessian coordinated points.
The options in "insertionOptions" are considered in this method.
rangeScan | The scan to be inserted into this map |
robotPose | The robot 3D pose, default to (0,0,0|0deg,0deg,0deg). It is used to compute the sensor pose relative to the robot actual pose. Recall sensor pose is embeded in the observation class. |
Implements mrpt::slam::CPointsMap.
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.
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 void mrpt::slam::CColouredPointsMap::setAllPoints | ( | const std::vector< float > & | X, |
const std::vector< float > & | Y | ||
) | [inline, virtual] |
Set all the points at once from vectors with X and Y coordinates (Z=0).
Implements mrpt::slam::CPointsMap.
Definition at line 241 of file CColouredPointsMap.h.
virtual void mrpt::slam::CColouredPointsMap::setAllPoints | ( | const std::vector< float > & | X, |
const std::vector< float > & | Y, | ||
const std::vector< float > & | Z | ||
) | [inline, virtual] |
Set all the points at once from vectors with X,Y and Z coordinates.
Implements mrpt::slam::CPointsMap.
Definition at line 235 of file CColouredPointsMap.h.
void mrpt::slam::CColouredPointsMap::setAllPointsTemplate | ( | const VECTOR & | X, |
const VECTOR & | Y, | ||
const VECTOR & | Z = VECTOR() |
||
) | [inline] |
Set all the points at once from vectors with X,Y and Z coordinates (if Z is not provided, it will be set to all zeros).
RGB field of all points will be set to white color.
VECTOR | can be mrpt::vector_float or std::vector<float> or any other column or row Eigen::Matrix. |
Definition at line 218 of file CColouredPointsMap.h.
References ASSERT_, ASSERT_EQUAL_, and internal::y.
void mrpt::slam::CColouredPointsMap::setHeightFilterLevels | ( | const double | _z_min, |
const double | _z_max | ||
) | [inline] |
Set the min/max Z levels for points to be actually inserted in the map (only if enableFilterByHeight() was called before).
Definition at line 304 of file CColouredPointsMap.h.
void mrpt::slam::CColouredPointsMap::setPoint | ( | size_t | index, |
float | x, | ||
float | y, | ||
float | z, | ||
float | R, | ||
float | G, | ||
float | B | ||
) |
Changes a given point from map.
First index is 0.
Throws | std::exception on index out of bound. |
virtual void mrpt::slam::CColouredPointsMap::setPoint | ( | size_t | index, |
float | x, | ||
float | y | ||
) | [virtual] |
Changes a given point from map.
First index is 0.
Throws | std::exception on index out of bound. |
Implements mrpt::slam::CPointsMap.
virtual void mrpt::slam::CColouredPointsMap::setPoint | ( | size_t | index, |
CPoint3D & | p | ||
) | [virtual] |
Changes a given point from map, as a 3D point.
First index is 0.
Throws | std::exception on index out of bound. |
Implements mrpt::slam::CPointsMap.
virtual void mrpt::slam::CColouredPointsMap::setPoint | ( | size_t | index, |
CPoint2D & | p | ||
) | [virtual] |
Changes a given point from map, as a 2D point.
First index is 0.
Throws | std::exception on index out of bound. |
Implements mrpt::slam::CPointsMap.
virtual void mrpt::slam::CColouredPointsMap::setPoint | ( | size_t | index, |
float | x, | ||
float | y, | ||
float | z | ||
) | [virtual] |
Changes a given point from map.
First index is 0.
Throws | std::exception on index out of bound. |
Implements mrpt::slam::CPointsMap.
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.
Throws | std::exception on index out of bound. |
mrpt::utils::CLASSINIT mrpt::slam::CColouredPointsMap::_init_CColouredPointsMap [static, protected] |
Definition at line 55 of file CColouredPointsMap.h.
bool mrpt::slam::CColouredPointsMap::bFilterByHeight [private] |
Whether or not filter the input points by height.
Definition at line 317 of file CColouredPointsMap.h.
Definition at line 55 of file CColouredPointsMap.h.
Definition at line 55 of file CColouredPointsMap.h.
The options employed when inserting laser scans in the map.
Definition at line 291 of file CColouredPointsMap.h.
std::vector<float> mrpt::slam::CColouredPointsMap::m_color_B [protected] |
Definition at line 59 of file CColouredPointsMap.h.
std::vector<float> mrpt::slam::CColouredPointsMap::m_color_G [protected] |
Definition at line 59 of file CColouredPointsMap.h.
std::vector<float> mrpt::slam::CColouredPointsMap::m_color_R [protected] |
The color data.
Definition at line 59 of file CColouredPointsMap.h.
std::vector<float> mrpt::slam::CColouredPointsMap::m_min_dist [protected] |
Minimum distance from where the points have been seen.
Definition at line 62 of file CColouredPointsMap.h.
double mrpt::slam::CColouredPointsMap::z_max [private] |
Definition at line 312 of file CColouredPointsMap.h.
double mrpt::slam::CColouredPointsMap::z_min [private] |
The minimum and maximum height for a certain laser scan to be inserted into this map.
Definition at line 312 of file CColouredPointsMap.h.
Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN:exported at Tue Jan 25 21:56:31 UTC 2011 |