Point Cloud Library (PCL)  1.9.1-dev
organized_plane_detector.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2011, Willow Garage, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Willow Garage, Inc. nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *
34  * @author: Koen Buys
35  */
36 
37 #pragma once
38 
39 #include <pcl/pcl_exports.h>
40 #include <pcl/point_types.h>
41 #include <pcl/point_cloud.h>
42 
43 #include <pcl/features/integral_image_normal.h>
44 #include <pcl/segmentation/organized_multi_plane_segmentation.h>
45 #include <pcl/common/transforms.h>
46 #include <pcl/gpu/people/label_common.h>
47 
48 #include <boost/shared_ptr.hpp>
49 #include <string>
50 #include <vector>
51 
52 namespace pcl
53 {
54  namespace gpu
55  {
56  namespace people
57  {
59  {
60  public:
61  using Ptr = boost::shared_ptr<OrganizedPlaneDetector>;
62  using ConstPtr = boost::shared_ptr<const OrganizedPlaneDetector>;
63 
66 
68 
69  //using Labels = DeviceArray2D<unsigned char>;
70  //using Depth = DeviceArray2D<unsigned short>;
71  //using Image = DeviceArray2D<pcl::RGB>;
72 
73  HostLabelProbability P_l_host_; // This is a HOST histogram!
75 
76  pcl::device::LabelProbability P_l_dev_; // This is a DEVICE histogram!
78 
79  protected:
82 
85 
90 
91  public:
92  /** \brief This is the constructor **/
93  OrganizedPlaneDetector (int rows = 480, int cols = 640);
94 
95  /** \brief Process step, this wraps Organized Plane Segmentation code **/
96  void process (const PointCloud<PointTC>::ConstPtr &cloud);
97 
98  double getMpsAngularThreshold () const
99  {
100  return mps_AngularThreshold_;
101  }
102 
103  void setMpsAngularThreshold (double mpsAngularThreshold)
104  {
105  mps_AngularThreshold_ = mpsAngularThreshold;
106  mps_.setAngularThreshold (mps_AngularThreshold_);
107  }
108 
109  double getMpsDistanceThreshold () const
110  {
111  return mps_DistanceThreshold_;
112  }
113 
114  void setMpsDistanceThreshold (double mpsDistanceThreshold)
115  {
116  mps_DistanceThreshold_ = mpsDistanceThreshold;
117  mps_.setDistanceThreshold (mps_DistanceThreshold_);
118  }
119 
120  int getMpsMinInliers () const
121  {
122  return mps_MinInliers_;
123  }
124 
125  void setMpsMinInliers (int mpsMinInliers)
126  {
127  mps_MinInliers_ = mpsMinInliers;
128  mps_.setMinInliers (mps_MinInliers_);
129 
130 
131  }
132 
134  {
136  }
137 
138  void setNeMaxDepthChangeFactor (float neMaxDepthChangeFactor)
139  {
140  ne_MaxDepthChangeFactor_ = neMaxDepthChangeFactor;
141  ne_.setMaxDepthChangeFactor (ne_MaxDepthChangeFactor_);
142  }
143 
145  {
147  }
148 
149  void setNeNormalSmoothingSize (float neNormalSmoothingSize)
150  {
151  ne_NormalSmoothingSize_ = neNormalSmoothingSize;
152  ne_.setNormalSmoothingSize (ne_NormalSmoothingSize_);
153  }
154 
155  void
157 
158  int
160  HostLabelProbability& dst);
161 
162  int
164  HostLabelProbability& dst);
165 
166  private:
167  void allocate_buffers(int rows = 480, int cols = 640);
168 
169  };
170  }
171  }
172 }
int copyHostLabelProbability(HostLabelProbability &src, HostLabelProbability &dst)
int copyAndClearHostLabelProbability(HostLabelProbability &src, HostLabelProbability &dst)
void setMinInliers(unsigned min_inliers)
Set the minimum number of inliers required for a plane.
This file defines compatibility wrappers for low level I/O functions.
Definition: convolution.h:45
DeviceArray2D class
Definition: device_array.h:153
void setMpsDistanceThreshold(double mpsDistanceThreshold)
boost::shared_ptr< const OrganizedPlaneDetector > ConstPtr
A point structure representing Euclidean xyz coordinates, and the RGBA color.
void setNeMaxDepthChangeFactor(float neMaxDepthChangeFactor)
pcl::IntegralImageNormalEstimation< PointTC, pcl::Normal > ne_
Defines all the PCL implemented PointT point type structures.
A point structure representing Euclidean xyz coordinates.
Surface normal estimation on organized data using integral images.
boost::shared_ptr< OrganizedPlaneDetector > Ptr
void setDistanceThreshold(double distance_threshold)
Set the tolerance in meters for difference in perpendicular distance (d component of plane equation) ...
void setMpsAngularThreshold(double mpsAngularThreshold)
void process(const PointCloud< PointTC >::ConstPtr &cloud)
Process step, this wraps Organized Plane Segmentation code.
void setMaxDepthChangeFactor(float max_depth_change_factor)
The depth change threshold for computing object borders.
void setAngularThreshold(double angular_threshold)
Set the tolerance in radians for difference in normal direction between neighboring points...
OrganizedMultiPlaneSegmentation finds all planes present in the input cloud, and outputs a vector of ...
void setNeNormalSmoothingSize(float neNormalSmoothingSize)
void emptyHostLabelProbability(HostLabelProbability &histogram)
boost::shared_ptr< const PointCloud< PointT > > ConstPtr
Definition: point_cloud.h:416
void setNormalSmoothingSize(float normal_smoothing_size)
Set the normal smoothing size.
OrganizedPlaneDetector(int rows=480, int cols=640)
This is the constructor.
pcl::OrganizedMultiPlaneSegmentation< PointTC, pcl::Normal, pcl::Label > mps_