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 
65 
67 
68  //using Labels = DeviceArray2D<unsigned char>;
69  //using Depth = DeviceArray2D<unsigned short>;
70  //using Image = DeviceArray2D<pcl::RGB>;
71 
72  HostLabelProbability P_l_host_; // This is a HOST histogram!
74 
75  pcl::device::LabelProbability P_l_dev_; // This is a DEVICE histogram!
77 
78  protected:
81 
84 
89 
90  public:
91  /** \brief This is the constructor **/
92  OrganizedPlaneDetector (int rows = 480, int cols = 640);
93 
94  /** \brief Process step, this wraps Organized Plane Segmentation code **/
95  void process (const PointCloud<PointTC>::ConstPtr &cloud);
96 
97  double getMpsAngularThreshold () const
98  {
99  return mps_AngularThreshold_;
100  }
101 
102  void setMpsAngularThreshold (double mpsAngularThreshold)
103  {
104  mps_AngularThreshold_ = mpsAngularThreshold;
105  mps_.setAngularThreshold (mps_AngularThreshold_);
106  }
107 
108  double getMpsDistanceThreshold () const
109  {
110  return mps_DistanceThreshold_;
111  }
112 
113  void setMpsDistanceThreshold (double mpsDistanceThreshold)
114  {
115  mps_DistanceThreshold_ = mpsDistanceThreshold;
116  mps_.setDistanceThreshold (mps_DistanceThreshold_);
117  }
118 
119  int getMpsMinInliers () const
120  {
121  return mps_MinInliers_;
122  }
123 
124  void setMpsMinInliers (int mpsMinInliers)
125  {
126  mps_MinInliers_ = mpsMinInliers;
127  mps_.setMinInliers (mps_MinInliers_);
128 
129 
130  }
131 
133  {
135  }
136 
137  void setNeMaxDepthChangeFactor (float neMaxDepthChangeFactor)
138  {
139  ne_MaxDepthChangeFactor_ = neMaxDepthChangeFactor;
140  ne_.setMaxDepthChangeFactor (ne_MaxDepthChangeFactor_);
141  }
142 
144  {
146  }
147 
148  void setNeNormalSmoothingSize (float neNormalSmoothingSize)
149  {
150  ne_NormalSmoothingSize_ = neNormalSmoothingSize;
151  ne_.setNormalSmoothingSize (ne_NormalSmoothingSize_);
152  }
153 
154  void
156 
157  int
159  HostLabelProbability& dst);
160 
161  int
163  HostLabelProbability& dst);
164 
165  private:
166  void allocate_buffers(int rows = 480, int cols = 640);
167 
168  };
169  }
170  }
171 }
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)
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:445
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_