Point Cloud Library (PCL)  1.14.1-dev
planar_region.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2010-2012, Willow Garage, Inc.
6  *
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials provided
18  * with the distribution.
19  * * Neither the name of the copyright holder(s) nor the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  */
37 
38 #pragma once
39 
40 #include <pcl/memory.h>
41 #include <pcl/pcl_macros.h>
42 #include <pcl/segmentation/region_3d.h>
43 #include <pcl/geometry/planar_polygon.h>
44 
45 namespace pcl
46 {
47  /** \brief PlanarRegion represents a set of points that lie in a plane. Inherits summary statistics about these points from Region3D, and summary statistics of a 3D collection of points.
48  * \author Alex Trevor
49  */
50  template <typename PointT>
51  class PlanarRegion : public pcl::Region3D<PointT>, public pcl::PlanarPolygon<PointT>
52  {
53  protected:
59 
60  public:
61  /** \brief Empty constructor for PlanarRegion. */
62  PlanarRegion () = default;
63 
64  /** \brief Constructor for Planar region from a Region3D and a PlanarPolygon.
65  * \param[in] region a Region3D for the input data
66  * \param[in] polygon a PlanarPolygon for the input region
67  */
69  {
70  centroid_ = region.centroid;
71  covariance_ = region.covariance;
72  count_ = region.count;
73  contour_ = polygon.contour;
74  coefficients_ = polygon.coefficients;
75  }
76 
77  /** \brief Destructor. */
78  ~PlanarRegion () override = default;
79 
80  /** \brief Constructor for PlanarRegion.
81  * \param[in] centroid the centroid of the region.
82  * \param[in] covariance the covariance of the region.
83  * \param[in] count the number of points in the region.
84  * \param[in] contour the contour / boundary for the region
85  * \param[in] coefficients the model coefficients (a,b,c,d) for the plane
86  */
87  PlanarRegion (const Eigen::Vector3f& centroid, const Eigen::Matrix3f& covariance, unsigned count,
88  const typename pcl::PointCloud<PointT>::VectorType& contour,
89  const Eigen::Vector4f& coefficients)
90  {
91  centroid_ = centroid;
92  covariance_ = covariance;
93  count_ = count;
94  contour_ = contour;
95  coefficients_ = coefficients;
96  }
97 
98  private:
99  /** \brief The labels (good=true, bad=false) for whether or not this boundary was observed,
100  * or was due to edge of frame / occlusion boundary.
101  */
102  std::vector<bool> contour_labels_;
103 
104  public:
106  };
107 }
PlanarPolygon represents a planar (2D) polygon, potentially in a 3D space.
Eigen::Vector4f coefficients_
A list of model coefficients (a,b,c,d).
pcl::PointCloud< PointT >::VectorType contour_
A list of points on the boundary/contour of the planar region.
PlanarRegion represents a set of points that lie in a plane.
Definition: planar_region.h:52
PlanarRegion()=default
Empty constructor for PlanarRegion.
PlanarRegion(const pcl::Region3D< PointT > &region, const pcl::PlanarPolygon< PointT > &polygon)
Constructor for Planar region from a Region3D and a PlanarPolygon.
Definition: planar_region.h:68
~PlanarRegion() override=default
Destructor.
PlanarRegion(const Eigen::Vector3f &centroid, const Eigen::Matrix3f &covariance, unsigned count, const typename pcl::PointCloud< PointT >::VectorType &contour, const Eigen::Vector4f &coefficients)
Constructor for PlanarRegion.
Definition: planar_region.h:87
std::vector< PointT, Eigen::aligned_allocator< PointT > > VectorType
Definition: point_cloud.h:411
Region3D represents summary statistics of a 3D collection of points.
Definition: region_3d.h:52
Eigen::Vector3f centroid_
The centroid of the region.
Definition: region_3d.h:109
unsigned count_
The number of points in the region.
Definition: region_3d.h:115
Eigen::Matrix3f covariance_
The covariance of the region.
Definition: region_3d.h:112
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Definition: memory.h:86
Defines functions, macros and traits for allocating and using memory.
Defines all the PCL and non-PCL macros used.