Main MRPT website > C++ reference for MRPT 1.4.0
Plane.h
Go to the documentation of this file.
1/* +---------------------------------------------------------------------------+
2 | Mobile Robot Programming Toolkit (MRPT) |
3 | http://www.mrpt.org/ |
4 | |
5 | Copyright (c) 2005-2016, Individual contributors, see AUTHORS file |
6 | See: http://www.mrpt.org/Authors - All rights reserved. |
7 | Released under BSD License. See details in http://www.mrpt.org/License |
8 +---------------------------------------------------------------------------+ */
9
10/* Plane-based Map (PbMap) library
11 * Construction of plane-based maps and localization in it from RGBD Images.
12 * Writen by Eduardo Fernandez-Moral. See docs for <a href="group__mrpt__pbmap__grp.html" >mrpt-pbmap</a>
13 */
14
15#ifndef __PBMAP_PLANE_H
16#define __PBMAP_PLANE_H
17
18#include <mrpt/config.h>
19
20#if MRPT_HAS_PCL
21
24
26#include <pcl/point_types.h>
27#include <pcl/common/pca.h>
28#include <set>
29#include <map>
30
31#define USE_COMPLETNESS_HEURISTICS 1
32#define USE_INFERRED_STRUCTURE 1
33
34static std::vector<size_t> DEFAULT_VECTOR;
35
36namespace mrpt {
37namespace pbmap {
38 // This must be added to any CSerializable derived class:
40
41 /** A class used to store a planar feature (Plane for short).
42 * It is described with geometric features representing the shape and relative
43 * location of the patch (area, normal vector, elongation, 3D-convex hull, etc.)
44 * and radiometric features (the most representative color).
45 *
46 * \ingroup mrpt_pbmap_grp
47 */
48 class PBMAP_IMPEXP Plane : public mrpt::utils::CSerializable
49 {
50 // This must be added to any CSerializable derived class:
52
53 public:
55 elongation(1.0),
56 bFullExtent(false),
57 bFromStructure(false),
58// contourPtr(new pcl::PointCloud<pcl::PointXYZRGBA>),
59 polygonContourPtr(new pcl::PointCloud<pcl::PointXYZRGBA>),
60 planePointCloudPtr(new pcl::PointCloud<pcl::PointXYZRGBA>)
61 {
62// vector< vector<int> > vec(4, vector<int>(4));
63 }
64
65 /*!
66 * Force the plane inliers to lay on the plane
67 */
69
70 /**!
71 * Calculate the plane's convex hull with the monotone chain algorithm.
72 */
73// void calcConvexHull(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr &pointCloud );
74 void calcConvexHull(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr &pointCloud, std::vector<size_t> &indices = DEFAULT_VECTOR );
75
76 void calcConvexHullandParams(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr &pointCloud, std::vector<size_t> &indices = DEFAULT_VECTOR );
77
78 /** \brief Compute the area of a 2D planar polygon patch - using a given normal
79// * \param polygonContourPtr the point cloud (planar)
80// * \param normal the plane normal
81 */
82 float compute2DPolygonalArea (/*pcl::PointCloud<pcl::PointXYZRGBA>::Ptr &polygonContourPtr, Vector<3> &normal*/);
83
84 /** \brief Compute the patch's convex-hull area and mass center
85 */
87
88 /*!
89 * Calculate plane's elongation and principal direction
90 */
92
93
94 /*!Returns true when the closest distance between the patches "this" and "plane" is under distThreshold.*/
95 bool isPlaneNearby(Plane &plane, const float distThreshold);
96
97 /*! Returns true if the two input planes represent the same physical surface for some given angle and distance thresholds.
98 * If the planes are the same they are merged in this and the function returns true. Otherwise it returns false.*/
99 bool isSamePlane(Plane &plane, const float &cosAngleThreshold, const float &distThreshold, const float &proxThreshold);
100
101 bool isSamePlane(Eigen::Matrix4f &Rt, Plane &plane_, const float &cosAngleThreshold, const float &distThreshold, const float &proxThreshold);
102
103 bool hasSimilarDominantColor(Plane &plane, const float colorThreshold);
104
105 /*! Merge the two input patches into "updatePlane".
106 * Recalculate center, normal vector, area, inlier points (filtered), convex hull, etc.
107 */
108 void mergePlane(Plane &plane);
109 void mergePlane2(Plane &plane);// Adaptation for RGBD360
110
111 void transform(Eigen::Matrix4f &Rt);
112
113
114 /**!
115 * Parameters to allow the plane-based representation of the map by a graph
116 */
117 unsigned id;
120 std::set<unsigned> nearbyPlanes;
121 std::map<unsigned,unsigned> neighborPlanes;
122
123 /*!Labels to store semantic attributes*/
124 std::string label;
125 std::string label_object;
126 std::string label_context;
127
128 /**!
129 * Geometric description
130 */
131 Eigen::Vector3f v3center;
132 Eigen::Vector3f v3normal;
133 float d;
134 Eigen::Matrix4f information; // Fisher information matrix (the inverse of the plane covariance)
136 Eigen::Vector3f v3PpalDir;
137 float elongation; // This is the reatio between the lengths of the plane in the two principal directions
139 float areaHull;
143
144 /**!
145 * Radiometric description
146 */
147 Eigen::Vector3f v3colorNrgb;
150 Eigen::Vector3f v3colorNrgbDev;
151
152 Eigen::Vector3f v3colorC1C2C3; // Color paper
153 std::vector<float> hist_H; // Normalized, Saturated Hue histogram (including 2 bins for black and white)
154
155 std::vector<double> prog_area;
156 std::vector<double> prog_elongation; // This is the reatio between the lengths of the plane in the two principal directions
157 std::vector<Eigen::Vector3f> prog_C1C2C3;
158 std::vector<Eigen::Vector3f> prog_Nrgb;
159 std::vector<float> prog_intensity;
160 std::vector<std::vector<float> > prog_hist_H;
161
162 /**!
163 * Convex Hull
164 */
165// pcl::PointCloud<pcl::PointXYZRGBA>::Ptr contourPtr;
166 std::vector<int32_t> inliers;
167 pcl::PointCloud<pcl::PointXYZRGBA>::Ptr polygonContourPtr;
168 pcl::PointCloud<pcl::PointXYZRGBA>::Ptr outerPolygonPtr; // This is going to be deprecated
169 pcl::PointCloud<pcl::PointXYZRGBA>::Ptr planePointCloudPtr; // This is going to be deprecated
170
171 /*!
172 * Calculate plane's main color using "MeanShift" method
173 */
177
178 private:
179 /*!
180 * Calculate plane's main color in normalized rgb space
181 */
183 std::vector<float> r;
184 std::vector<float> g;
185 std::vector<float> b;
186 std::vector<float> intensity;
187
188 // Color paper
189 /*!
190 * Calculate plane's main color in C1C2C3 representation
191 */
192 std::vector<float> c1;
193 std::vector<float> c2;
194 std::vector<float> c3;
196
197 /*!
198 * Calculate plane's main color in HSV representation
199 */
200// vector<float> H;
201// vector<float> S;
202// vector<vector<float> > HSV;
203
204 };
206
207} } // End of namespaces
208
209#endif
210
211#endif
#define DEFINE_SERIALIZABLE_POST_CUSTOM_LINKAGE(class_name, _LINKAGE_)
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_LINKAGE(class_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
static std::vector< size_t > DEFAULT_VECTOR
Definition Plane.h:34
A class used to store a planar feature (Plane for short).
Definition Plane.h:49
std::vector< float > g
Definition Plane.h:184
float dominantIntensity
Definition Plane.h:148
std::string label_context
Definition Plane.h:126
std::set< unsigned > nearbyPlanes
Definition Plane.h:120
Eigen::Vector3f v3normal
Definition Plane.h:132
void calcConvexHullandParams(pcl::PointCloud< pcl::PointXYZRGBA >::Ptr &pointCloud, std::vector< size_t > &indices=DEFAULT_VECTOR)
std::vector< Eigen::Vector3f > prog_Nrgb
Definition Plane.h:158
void mergePlane(Plane &plane)
std::vector< int32_t > inliers
! Convex Hull
Definition Plane.h:166
void transform(Eigen::Matrix4f &Rt)
std::string label_object
Definition Plane.h:125
std::string label
Definition Plane.h:124
std::vector< float > c3
Definition Plane.h:194
std::vector< double > prog_area
Definition Plane.h:155
std::vector< float > c1
Definition Plane.h:192
std::vector< double > prog_elongation
Definition Plane.h:156
void computeMassCenterAndArea()
Compute the patch's convex-hull area and mass center.
Eigen::Vector3f v3PpalDir
Definition Plane.h:136
pcl::PointCloud< pcl::PointXYZRGBA >::Ptr polygonContourPtr
Definition Plane.h:167
std::vector< Eigen::Vector3f > prog_C1C2C3
Definition Plane.h:157
unsigned numObservations
Definition Plane.h:118
std::vector< float > r
Definition Plane.h:183
std::vector< float > intensity
Definition Plane.h:186
std::vector< float > prog_intensity
Definition Plane.h:159
std::map< unsigned, unsigned > neighborPlanes
Definition Plane.h:121
pcl::PointCloud< pcl::PointXYZRGBA >::Ptr planePointCloudPtr
Definition Plane.h:169
bool bDominantColor
Definition Plane.h:149
unsigned nFramesAreaIsStable
Definition Plane.h:142
bool isPlaneNearby(Plane &plane, const float distThreshold)
bool isSamePlane(Eigen::Matrix4f &Rt, Plane &plane_, const float &cosAngleThreshold, const float &distThreshold, const float &proxThreshold)
Eigen::Vector3f v3colorC1C2C3
Definition Plane.h:152
std::vector< std::vector< float > > prog_hist_H
Definition Plane.h:160
std::vector< float > hist_H
Definition Plane.h:153
Eigen::Vector3f v3colorNrgbDev
Definition Plane.h:150
void calcElongationAndPpalDir()
bool isSamePlane(Plane &plane, const float &cosAngleThreshold, const float &distThreshold, const float &proxThreshold)
unsigned id
! Parameters to allow the plane-based representation of the map by a graph
Definition Plane.h:117
bool hasSimilarDominantColor(Plane &plane, const float colorThreshold)
float compute2DPolygonalArea()
Compute the area of a 2D planar polygon patch - using a given normal.
pcl::PointCloud< pcl::PointXYZRGBA >::Ptr outerPolygonPtr
Definition Plane.h:168
std::vector< float > c2
Definition Plane.h:193
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.
Eigen::Vector3f v3center
! Geometric description
Definition Plane.h:131
unsigned semanticGroup
Definition Plane.h:119
Eigen::Matrix4f information
Definition Plane.h:134
bool bFromStructure
Definition Plane.h:141
void mergePlane2(Plane &plane)
Eigen::Vector3f v3colorNrgb
! Radiometric description
Definition Plane.h:147
std::vector< float > b
Definition Plane.h:185
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.



Page generated by Doxygen 1.9.7 for MRPT 1.4.0 SVN: at Tue Jun 27 15:23:24 UTC 2023