MRPT  1.9.9
mrpt::pbmap::Plane Class Reference

Detailed Description

A class used to store a planar feature (Plane for short).

It is described with geometric features representing the shape and relative location of the patch (area, normal vector, elongation, 3D-convex hull, etc.) and radiometric features (the most representative color).

Definition at line 43 of file Plane.h.

#include <mrpt/pbmap/Plane.h>

Inheritance diagram for mrpt::pbmap::Plane:

Public Member Functions

 Plane ()
 
void forcePtsLayOnPlane ()
 
void calcConvexHull (pcl::PointCloud< pcl::PointXYZRGBA >::Ptr &pointCloud, std::vector< size_t > &indices=DEFAULT_VECTOR)
 ! Calculate the plane's convex hull with the monotone chain algorithm. More...
 
void calcConvexHullandParams (pcl::PointCloud< pcl::PointXYZRGBA >::Ptr &pointCloud, std::vector< size_t > &indices=DEFAULT_VECTOR)
 
float compute2DPolygonalArea ()
 Compute the area of a 2D planar polygon patch - using a given normal. More...
 
void computeMassCenterAndArea ()
 Compute the patch's convex-hull area and mass center. More...
 
void calcElongationAndPpalDir ()
 
bool isPlaneNearby (Plane &plane, const float distThreshold)
 
bool isSamePlane (Plane &plane, const float &cosAngleThreshold, const float &distThreshold, const float &proxThreshold)
 
bool isSamePlane (Eigen::Matrix4f &Rt, Plane &plane_, const float &cosAngleThreshold, const float &distThreshold, const float &proxThreshold)
 
bool hasSimilarDominantColor (Plane &plane, const float colorThreshold)
 
void mergePlane (Plane &plane)
 
void mergePlane2 (Plane &plane)
 
void transform (Eigen::Matrix4f &Rt)
 
void calcMainColor ()
 
void calcMainColor2 ()
 
void calcPlaneHistH ()
 
virtual mxArraywriteToMatlab () const
 Introduces a pure virtual method responsible for writing to a mxArray Matlab object, typically a MATLAB struct whose contents are documented in each derived class. More...
 
RTTI classes and functions for polymorphic hierarchies
mrpt::rtti::CObject::Ptr duplicateGetSmartPtr () const
 Makes a deep copy of the object and returns a smart pointer to it. More...
 

Public Attributes

unsigned id
 ! Parameters to allow the plane-based representation of the map by a graph More...
 
unsigned numObservations
 
unsigned semanticGroup
 
std::set< unsigned > nearbyPlanes
 
std::map< unsigned, unsigned > neighborPlanes
 
std::string label
 
std::string label_object
 
std::string label_context
 
Eigen::Vector3f v3center
 ! Geometric description More...
 
Eigen::Vector3f v3normal
 
float d
 
Eigen::Matrix4f information
 
float curvature
 
Eigen::Vector3f v3PpalDir
 
float elongation
 
float areaVoxels
 
float areaHull
 
bool bFullExtent
 
bool bFromStructure
 
unsigned nFramesAreaIsStable
 
Eigen::Vector3f v3colorNrgb
 ! Radiometric description More...
 
float dominantIntensity
 
bool bDominantColor
 
Eigen::Vector3f v3colorNrgbDev
 
Eigen::Vector3f v3colorC1C2C3
 
std::vector< float > hist_H
 
std::vector< double > prog_area
 
std::vector< double > prog_elongation
 
std::vector< Eigen::Vector3f > prog_C1C2C3
 
std::vector< Eigen::Vector3f > prog_Nrgb
 
std::vector< float > prog_intensity
 
std::vector< std::vector< float > > prog_hist_H
 
std::vector< int32_tinliers
 ! Convex Hull More...
 
pcl::PointCloud< pcl::PointXYZRGBA >::Ptr polygonContourPtr
 
pcl::PointCloud< pcl::PointXYZRGBA >::Ptr outerPolygonPtr
 
pcl::PointCloud< pcl::PointXYZRGBA >::Ptr planePointCloudPtr
 

Protected Member Functions

CSerializable virtual methods
uint8_t serializeGetVersion () const override
 *---------------------------------------------------———— More...
 
void serializeTo (mrpt::serialization::CArchive &out) const override
 Pure virtual method for writing (serializing) to an abstract archive. More...
 
void serializeFrom (mrpt::serialization::CArchive &in, uint8_t serial_version) override
 Pure virtual method for reading (deserializing) from an abstract archive. More...
 
CSerializable virtual methods
virtual void serializeTo (CSchemeArchiveBase &out) const
 Virtual method for writing (serializing) to an abstract schema based archive. More...
 
virtual void serializeFrom (CSchemeArchiveBase &in)
 Virtual method for reading (deserializing) from an abstract schema based archive. More...
 

Private Member Functions

void getPlaneNrgb ()
 
void getPlaneC1C2C3 ()
 

Private Attributes

std::vector< float > r
 
std::vector< float > g
 
std::vector< float > b
 
std::vector< float > intensity
 
std::vector< float > c1
 
std::vector< float > c2
 
std::vector< float > c3
 

RTTI stuff

using Ptr = std::shared_ptr< Plane >
 
using ConstPtr = std::shared_ptr< const Plane >
 
using UniquePtr = std::unique_ptr< Plane >
 
using ConstUniquePtr = std::unique_ptr< const Plane >
 
static mrpt::rtti::CLASSINIT _init_Plane
 
static const mrpt::rtti::TRuntimeClassId runtimeClassId
 
static constexpr const char * className = "Plane"
 
static const mrpt::rtti::TRuntimeClassId_GetBaseClass ()
 
static constexpr auto getClassName ()
 
static const mrpt::rtti::TRuntimeClassIdGetRuntimeClassIdStatic ()
 
static std::shared_ptr< CObjectCreateObject ()
 
template<typename... Args>
static Ptr Create (Args &&... args)
 
template<typename Alloc , typename... Args>
static Ptr CreateAlloc (const Alloc &alloc, Args &&... args)
 
template<typename... Args>
static UniquePtr CreateUnique (Args &&... args)
 
virtual const mrpt::rtti::TRuntimeClassIdGetRuntimeClass () const override
 Returns information about the class of an object in runtime. More...
 
virtual mrpt::rtti::CObjectclone () const override
 Returns a deep copy (clone) of the object, indepently of its class. More...
 

Member Typedef Documentation

◆ ConstPtr

Definition at line 45 of file Plane.h.

◆ ConstUniquePtr

using mrpt::pbmap::Plane::ConstUniquePtr = std::unique_ptr<const Plane >

Definition at line 45 of file Plane.h.

◆ Ptr

A type for the associated smart pointer

Definition at line 45 of file Plane.h.

◆ UniquePtr

using mrpt::pbmap::Plane::UniquePtr = std::unique_ptr< Plane >

Definition at line 45 of file Plane.h.

Constructor & Destructor Documentation

◆ Plane()

mrpt::pbmap::Plane::Plane ( )
inline

Definition at line 48 of file Plane.h.

Member Function Documentation

◆ _GetBaseClass()

static const mrpt::rtti::TRuntimeClassId* mrpt::pbmap::Plane::_GetBaseClass ( )
staticprotected

◆ calcConvexHull()

void Plane::calcConvexHull ( pcl::PointCloud< pcl::PointXYZRGBA >::Ptr pointCloud,
std::vector< size_t > &  indices = DEFAULT_VECTOR 
)

! Calculate the plane's convex hull with the monotone chain algorithm.

Definition at line 761 of file Plane.cpp.

References cross().

Referenced by mrpt::pbmap::PbMapMaker::detectPlanesCloud(), and mrpt::pbmap::PbMapMaker::mergePlanes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ calcConvexHullandParams()

void Plane::calcConvexHullandParams ( pcl::PointCloud< pcl::PointXYZRGBA >::Ptr pointCloud,
std::vector< size_t > &  indices = DEFAULT_VECTOR 
)

Definition at line 829 of file Plane.cpp.

References cross(), and mrpt::math::norm().

Here is the call graph for this function:

◆ calcElongationAndPpalDir()

void Plane::calcElongationAndPpalDir ( )

Calculate plane's elongation and principal direction

Definition at line 331 of file Plane.cpp.

Referenced by mrpt::pbmap::PbMapMaker::detectPlanesCloud().

Here is the caller graph for this function:

◆ calcMainColor()

void Plane::calcMainColor ( )

Calculate plane's main color using "MeanShift" method

dominantIntensity = getHistogramMeanShift(intensity, 767.0, v3colorNrgbDev(2));
cout << "c1c2c3 in " << (getColorEnd - getColorStart)*1000000 << " us\n";

Definition at line 603 of file Plane.cpp.

References mrpt::pbmap::getHistogramMeanShift().

Referenced by mrpt::pbmap::PbMapMaker::detectPlanesCloud().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ calcMainColor2()

void Plane::calcMainColor2 ( )

Definition at line 532 of file Plane.cpp.

References concentrationThreshold, and mrpt::pbmap::getMultiDimMeanShift_color().

Here is the call graph for this function:

◆ calcPlaneHistH()

void Plane::calcPlaneHistH ( )

Definition at line 406 of file Plane.cpp.

◆ clone()

virtual mrpt::rtti::CObject* mrpt::pbmap::Plane::clone ( ) const
overridevirtual

Returns a deep copy (clone) of the object, indepently of its class.

Implements mrpt::rtti::CObject.

◆ compute2DPolygonalArea()

float Plane::compute2DPolygonalArea ( )

Compute the area of a 2D planar polygon patch - using a given normal.

Compute the area of a 2D planar polygon patch.

Parameters
polygonContourPtrthe point cloud (planar)
normalthe plane normal

Definition at line 249 of file Plane.cpp.

Referenced by mrpt::pbmap::PbMapMaker::detectPlanesCloud().

Here is the caller graph for this function:

◆ computeMassCenterAndArea()

void Plane::computeMassCenterAndArea ( )

Compute the patch's convex-hull area and mass center.

Definition at line 285 of file Plane.cpp.

Referenced by mrpt::pbmap::PbMapMaker::detectPlanesCloud(), and mrpt::pbmap::PbMapMaker::mergePlanes().

Here is the caller graph for this function:

◆ Create()

template<typename... Args>
static Ptr mrpt::pbmap::Plane::Create ( Args &&...  args)
inlinestatic

Definition at line 45 of file Plane.h.

◆ CreateAlloc()

template<typename Alloc , typename... Args>
static Ptr mrpt::pbmap::Plane::CreateAlloc ( const Alloc &  alloc,
Args &&...  args 
)
inlinestatic

Definition at line 45 of file Plane.h.

◆ CreateObject()

static std::shared_ptr<CObject> mrpt::pbmap::Plane::CreateObject ( )
static

◆ CreateUnique()

template<typename... Args>
static UniquePtr mrpt::pbmap::Plane::CreateUnique ( Args &&...  args)
inlinestatic

Definition at line 45 of file Plane.h.

◆ duplicateGetSmartPtr()

mrpt::rtti::CObject::Ptr CObject::duplicateGetSmartPtr ( ) const
inlineinherited

Makes a deep copy of the object and returns a smart pointer to it.

Definition at line 200 of file CObject.h.

References mrpt::rtti::CObject::clone().

Referenced by mrpt::obs::CRawlog::addActions(), and mrpt::obs::CRawlog::addObservations().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ forcePtsLayOnPlane()

void Plane::forcePtsLayOnPlane ( )

Force the plane inliers to lay on the plane

Definition at line 220 of file Plane.cpp.

Referenced by mrpt::pbmap::PbMapMaker::mergePlanes().

Here is the caller graph for this function:

◆ getClassName()

static constexpr auto mrpt::pbmap::Plane::getClassName ( )
inlinestatic

Definition at line 45 of file Plane.h.

◆ getPlaneC1C2C3()

void Plane::getPlaneC1C2C3 ( )
private

Definition at line 380 of file Plane.cpp.

◆ getPlaneNrgb()

void Plane::getPlaneNrgb ( )
private

Calculate plane's main color in normalized rgb space

Definition at line 349 of file Plane.cpp.

◆ GetRuntimeClass()

virtual const mrpt::rtti::TRuntimeClassId* mrpt::pbmap::Plane::GetRuntimeClass ( ) const
overridevirtual

Returns information about the class of an object in runtime.

Reimplemented from mrpt::serialization::CSerializable.

◆ GetRuntimeClassIdStatic()

static const mrpt::rtti::TRuntimeClassId& mrpt::pbmap::Plane::GetRuntimeClassIdStatic ( )
static

◆ hasSimilarDominantColor()

bool Plane::hasSimilarDominantColor ( Plane plane,
const float  colorThreshold 
)

Definition at line 1068 of file Plane.cpp.

References bDominantColor, and v3colorNrgb.

◆ isPlaneNearby()

bool Plane::isPlaneNearby ( Plane plane_nearby,
const float  distThreshold 
)

Returns true when the closest distance between the patches "this" and "plane" is under distThreshold.

Returns true when the closest distance between the patches "this" and the input "plane_nearby" is under distThreshold. This function is approximated

Definition at line 960 of file Plane.cpp.

References mrpt::pbmap::diffPoints(), mrpt::pbmap::dist3D_Segment_to_Segment2(), mrpt::pbmap::getVector3fromPointXYZ(), polygonContourPtr, and v3center.

Here is the call graph for this function:

◆ isSamePlane() [1/2]

bool Plane::isSamePlane ( Plane plane_nearby,
const float &  cosAngleThreshold,
const float &  parallelDistThres,
const float &  proxThreshold 
)

Returns true if the two input planes represent the same physical surface for some given angle and distance thresholds. If the planes are the same they are merged in this and the function returns true. Otherwise it returns false.

Definition at line 1011 of file Plane.cpp.

References v3center, and v3normal.

◆ isSamePlane() [2/2]

bool Plane::isSamePlane ( Eigen::Matrix4f &  Rt,
Plane plane_,
const float &  cosAngleThreshold,
const float &  parallelDistThres,
const float &  proxThreshold 
)

Check if the the input plane is the same than this plane for some given angle and distance thresholds. If the planes are the same they are merged in this and the function returns true. Otherwise it returns false.

if(fabs(dist_normal) > parallelDistThres ) // Avoid matching different parallel planes

Definition at line 1034 of file Plane.cpp.

References d, polygonContourPtr, v3center, and v3normal.

◆ mergePlane()

void Plane::mergePlane ( Plane same_plane_patch)

Merge the two input patches into "updatePlane". Recalculate center, normal vector, area, inlier points (filtered), convex hull, etc.

Merge the input "same_plane_patch" into "this". Recalculate center, normal vector, area, inlier points (filtered), convex hull, etc.

Definition at line 1082 of file Plane.cpp.

References inliers, planePointCloudPtr, polygonContourPtr, and v3normal.

◆ mergePlane2()

void Plane::mergePlane2 ( Plane plane)

Definition at line 1135 of file Plane.cpp.

References hist_H, inliers, planePointCloudPtr, polygonContourPtr, and v3normal.

◆ serializeFrom() [1/2]

void Plane::serializeFrom ( mrpt::serialization::CArchive in,
uint8_t  serial_version 
)
overrideprotectedvirtual

Pure virtual method for reading (deserializing) from an abstract archive.

Users don't call this method directly. Instead, use stream >> object;.

Parameters
inThe input binary stream where the object data must read from.
versionThe version of the object stored in the stream: use this version number in your code to know how to read the incoming data.
Exceptions
std::exceptionOn any I/O error

in >> v3colorNrgbDev(0) >> v3colorNrgbDev(1) >> v3colorNrgbDev(2);

Implements mrpt::serialization::CSerializable.

Definition at line 172 of file Plane.cpp.

References MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION.

◆ serializeFrom() [2/2]

virtual void mrpt::serialization::CSerializable::serializeFrom ( CSchemeArchiveBase in)
inlineprotectedvirtualinherited

Virtual method for reading (deserializing) from an abstract schema based archive.

Definition at line 74 of file CSerializable.h.

References mrpt::serialization::CSerializable::GetRuntimeClass(), and THROW_EXCEPTION.

Here is the call graph for this function:

◆ serializeGetVersion()

uint8_t Plane::serializeGetVersion ( ) const
overrideprotectedvirtual

*---------------------------------------------------————

out.WriteBufferFixEndianness<Eigen::Vector3f::Scalar>(&v3colorNrgbDev(0),3); *---------------------------------------------------------—— in.ReadBufferFixEndianness<Eigen::Vector3f::Scalar>(&v3normal[0],sizeof(v3normal[0])*3); / in.ReadBufferFixEndianness<Eigen::Vector3f::Scalar>(&v3center[0],sizeof(v3center[0])*3); / in.ReadBufferFixEndianness<Eigen::Vector3f::Scalar>(&v3PpalDir[0],sizeof(v3PpalDir[0])*3); / in.ReadBufferFixEndianness<Eigen::Vector3f::Scalar>(&v3colorNrgb[0],sizeof(v3colorNrgb[0])*3); / in.ReadBufferFixEndianness<Eigen::Vector3f::Scalar>(&v3colorNrgbDev[0],sizeof(v3colorNrgbDev[0])*3);

Implements mrpt::serialization::CSerializable.

Definition at line 136 of file Plane.cpp.

◆ serializeTo() [1/2]

void Plane::serializeTo ( mrpt::serialization::CArchive out) const
overrideprotectedvirtual

Pure virtual method for writing (serializing) to an abstract archive.

Users don't call this method directly. Instead, use stream << object;.

Exceptions
std::exceptionOn any I/O error

out << v3colorNrgbDev(0) << v3colorNrgbDev(1) << v3colorNrgbDev(2);

Implements mrpt::serialization::CSerializable.

Definition at line 137 of file Plane.cpp.

◆ serializeTo() [2/2]

virtual void mrpt::serialization::CSerializable::serializeTo ( CSchemeArchiveBase out) const
inlineprotectedvirtualinherited

Virtual method for writing (serializing) to an abstract schema based archive.

Definition at line 64 of file CSerializable.h.

References mrpt::serialization::CSerializable::GetRuntimeClass(), and THROW_EXCEPTION.

Here is the call graph for this function:

◆ transform()

void Plane::transform ( Eigen::Matrix4f &  Rt)

Definition at line 1179 of file Plane.cpp.

◆ writeToMatlab()

virtual mxArray* mrpt::serialization::CSerializable::writeToMatlab ( ) const
inlinevirtualinherited

Introduces a pure virtual method responsible for writing to a mxArray Matlab object, typically a MATLAB struct whose contents are documented in each derived class.

Returns
A new mxArray (caller is responsible of memory freeing) or nullptr is class does not support conversion to MATLAB.

Definition at line 90 of file CSerializable.h.

Member Data Documentation

◆ _init_Plane

mrpt::rtti::CLASSINIT mrpt::pbmap::Plane::_init_Plane
staticprotected

Definition at line 45 of file Plane.h.

◆ areaHull

◆ areaVoxels

◆ b

std::vector<float> mrpt::pbmap::Plane::b
private

Definition at line 199 of file Plane.h.

◆ bDominantColor

bool mrpt::pbmap::Plane::bDominantColor

Definition at line 158 of file Plane.h.

Referenced by hasSimilarDominantColor().

◆ bFromStructure

◆ bFullExtent

◆ c1

std::vector<float> mrpt::pbmap::Plane::c1
private

Calculate plane's main color in C1C2C3 representation

Definition at line 206 of file Plane.h.

◆ c2

std::vector<float> mrpt::pbmap::Plane::c2
private

Definition at line 207 of file Plane.h.

◆ c3

std::vector<float> mrpt::pbmap::Plane::c3
private

Definition at line 208 of file Plane.h.

◆ className

constexpr const char* mrpt::pbmap::Plane::className = "Plane"
static

Definition at line 45 of file Plane.h.

◆ curvature

float mrpt::pbmap::Plane::curvature

Definition at line 143 of file Plane.h.

◆ d

◆ dominantIntensity

float mrpt::pbmap::Plane::dominantIntensity

Definition at line 157 of file Plane.h.

Referenced by mrpt::pbmap::PbMapMaker::viz_cb().

◆ elongation

◆ g

std::vector<float> mrpt::pbmap::Plane::g
private

Definition at line 198 of file Plane.h.

◆ hist_H

◆ id

◆ information

Eigen::Matrix4f mrpt::pbmap::Plane::information

Definition at line 141 of file Plane.h.

◆ inliers

std::vector<int32_t> mrpt::pbmap::Plane::inliers

! Convex Hull

Definition at line 178 of file Plane.h.

Referenced by mergePlane(), and mergePlane2().

◆ intensity

std::vector<float> mrpt::pbmap::Plane::intensity
private

Definition at line 200 of file Plane.h.

◆ label

std::string mrpt::pbmap::Plane::label

Labels to store semantic attributes

Definition at line 131 of file Plane.h.

Referenced by mrpt::pbmap::PlaneInferredInfo::searchTheFloor().

◆ label_context

std::string mrpt::pbmap::Plane::label_context

Definition at line 133 of file Plane.h.

◆ label_object

std::string mrpt::pbmap::Plane::label_object

Definition at line 132 of file Plane.h.

◆ nearbyPlanes

std::set<unsigned> mrpt::pbmap::Plane::nearbyPlanes

◆ neighborPlanes

std::map<unsigned, unsigned> mrpt::pbmap::Plane::neighborPlanes

Definition at line 128 of file Plane.h.

Referenced by mrpt::pbmap::PbMapLocaliser::searchPlaneContext().

◆ nFramesAreaIsStable

unsigned mrpt::pbmap::Plane::nFramesAreaIsStable

Definition at line 151 of file Plane.h.

Referenced by mrpt::pbmap::PlaneInferredInfo::isFullExtent().

◆ numObservations

unsigned mrpt::pbmap::Plane::numObservations

Definition at line 125 of file Plane.h.

◆ outerPolygonPtr

pcl::PointCloud<pcl::PointXYZRGBA>::Ptr mrpt::pbmap::Plane::outerPolygonPtr

Definition at line 181 of file Plane.h.

Referenced by mrpt::pbmap::PlaneInferredInfo::isSurroundingBackground().

◆ planePointCloudPtr

pcl::PointCloud<pcl::PointXYZRGBA>::Ptr mrpt::pbmap::Plane::planePointCloudPtr

◆ polygonContourPtr

◆ prog_area

std::vector<double> mrpt::pbmap::Plane::prog_area

Definition at line 165 of file Plane.h.

◆ prog_C1C2C3

std::vector<Eigen::Vector3f> mrpt::pbmap::Plane::prog_C1C2C3

Definition at line 169 of file Plane.h.

◆ prog_elongation

std::vector<double> mrpt::pbmap::Plane::prog_elongation

Definition at line 166 of file Plane.h.

◆ prog_hist_H

std::vector<std::vector<float> > mrpt::pbmap::Plane::prog_hist_H

Definition at line 172 of file Plane.h.

◆ prog_intensity

std::vector<float> mrpt::pbmap::Plane::prog_intensity

Definition at line 171 of file Plane.h.

◆ prog_Nrgb

std::vector<Eigen::Vector3f> mrpt::pbmap::Plane::prog_Nrgb

Definition at line 170 of file Plane.h.

◆ r

std::vector<float> mrpt::pbmap::Plane::r
private

Definition at line 197 of file Plane.h.

◆ runtimeClassId

const mrpt::rtti::TRuntimeClassId mrpt::pbmap::Plane::runtimeClassId
staticprotected

Definition at line 45 of file Plane.h.

◆ semanticGroup

unsigned mrpt::pbmap::Plane::semanticGroup

Definition at line 126 of file Plane.h.

◆ v3center

◆ v3colorC1C2C3

Eigen::Vector3f mrpt::pbmap::Plane::v3colorC1C2C3

Definition at line 161 of file Plane.h.

◆ v3colorNrgb

Eigen::Vector3f mrpt::pbmap::Plane::v3colorNrgb

! Radiometric description

Definition at line 156 of file Plane.h.

Referenced by mrpt::pbmap::PbMapMaker::detectPlanesCloud(), hasSimilarDominantColor(), and mrpt::pbmap::PbMapMaker::viz_cb().

◆ v3colorNrgbDev

Eigen::Vector3f mrpt::pbmap::Plane::v3colorNrgbDev

Definition at line 159 of file Plane.h.

◆ v3normal

◆ v3PpalDir

Eigen::Vector3f mrpt::pbmap::Plane::v3PpalDir

Definition at line 144 of file Plane.h.

Referenced by mrpt::pbmap::PbMap::MergeWith().




Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019