Point Cloud Library (PCL)  1.11.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. */
63  {}
64 
65  /** \brief Constructor for Planar region from a Region3D and a PlanarPolygon.
66  * \param[in] region a Region3D for the input data
67  * \param[in] polygon a PlanarPolygon for the input region
68  */
70  {
71  centroid_ = region.centroid;
72  covariance_ = region.covariance;
73  count_ = region.count;
74  contour_ = polygon.contour;
75  coefficients_ = polygon.coefficients;
76  }
77 
78  /** \brief Destructor. */
80 
81  /** \brief Constructor for PlanarRegion.
82  * \param[in] centroid the centroid of the region.
83  * \param[in] covariance the covariance of the region.
84  * \param[in] count the number of points in the region.
85  * \param[in] contour the contour / boudnary for the region
86  * \param[in] coefficients the model coefficients (a,b,c,d) for the plane
87  */
88  PlanarRegion (const Eigen::Vector3f& centroid, const Eigen::Matrix3f& covariance, unsigned count,
89  const typename pcl::PointCloud<PointT>::VectorType& contour,
90  const Eigen::Vector4f& coefficients)
91  {
92  centroid_ = centroid;
93  covariance_ = covariance;
94  count_ = count;
95  contour_ = contour;
96  coefficients_ = coefficients;
97  }
98 
99  private:
100  /** \brief The labels (good=true, bad=false) for whether or not this boundary was observed,
101  * or was due to edge of frame / occlusion boundary.
102  */
103  std::vector<bool> contour_labels_;
104 
105  public:
107  };
108 }
pcl_macros.h
Defines all the PCL and non-PCL macros used.
pcl
Definition: convolution.h:46
pcl::Region3D::covariance_
Eigen::Matrix3f covariance_
The covariance of the region.
Definition: region_3d.h:113
pcl::PlanarPolygon::contour_
pcl::PointCloud< PointT >::VectorType contour_
A list of points on the boundary/contour of the planar region.
Definition: planar_polygon.h:133
pcl::PointCloud::VectorType
std::vector< PointT, Eigen::aligned_allocator< PointT > > VectorType
Definition: point_cloud.h:404
pcl::PlanarPolygon::coefficients_
Eigen::Vector4f coefficients_
A list of model coefficients (a,b,c,d).
Definition: planar_polygon.h:136
pcl::Region3D
Region3D represents summary statistics of a 3D collection of points.
Definition: region_3d.h:52
PCL_MAKE_ALIGNED_OPERATOR_NEW
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Definition: memory.h:63
pcl::PlanarRegion
PlanarRegion represents a set of points that lie in a plane.
Definition: planar_region.h:51
pcl::PlanarRegion::PlanarRegion
PlanarRegion()
Empty constructor for PlanarRegion.
Definition: planar_region.h:62
pcl::PlanarPolygon
PlanarPolygon represents a planar (2D) polygon, potentially in a 3D space.
Definition: planar_polygon.h:53
pcl::Region3D::count_
unsigned count_
The number of points in the region.
Definition: region_3d.h:116
pcl::PlanarRegion::PlanarRegion
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:88
memory.h
Defines functions, macros and traits for allocating and using memory.
pcl::Region3D::centroid_
Eigen::Vector3f centroid_
The centroid of the region.
Definition: region_3d.h:110
pcl::PlanarRegion::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:69
pcl::PlanarRegion::~PlanarRegion
~PlanarRegion()
Destructor.
Definition: planar_region.h:79