Point Cloud Library (PCL)  1.11.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/memory.h>
40 #include <pcl/pcl_exports.h>
41 #include <pcl/point_types.h>
42 #include <pcl/point_cloud.h>
43 
44 #include <pcl/features/integral_image_normal.h>
45 #include <pcl/segmentation/organized_multi_plane_segmentation.h>
46 #include <pcl/common/transforms.h>
47 #include <pcl/gpu/people/label_common.h>
48 
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 = shared_ptr<OrganizedPlaneDetector>;
62  using ConstPtr = 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 }
pcl::gpu::people::OrganizedPlaneDetector::setNeNormalSmoothingSize
void setNeNormalSmoothingSize(float neNormalSmoothingSize)
Definition: organized_plane_detector.h:149
pcl
Definition: convolution.h:46
point_types.h
pcl::gpu::people::OrganizedPlaneDetector::setNeMaxDepthChangeFactor
void setNeMaxDepthChangeFactor(float neMaxDepthChangeFactor)
Definition: organized_plane_detector.h:138
pcl::IntegralImageNormalEstimation
Surface normal estimation on organized data using integral images.
Definition: integral_image_normal.h:65
pcl::gpu::people::OrganizedPlaneDetector::mps_AngularThreshold_
double mps_AngularThreshold_
Definition: organized_plane_detector.h:87
pcl::gpu::people::OrganizedPlaneDetector::P_l_dev_prev_
pcl::device::LabelProbability P_l_dev_prev_
Definition: organized_plane_detector.h:77
pcl::gpu::people::OrganizedPlaneDetector::setMpsMinInliers
void setMpsMinInliers(int mpsMinInliers)
Definition: organized_plane_detector.h:125
pcl::gpu::people::OrganizedPlaneDetector::ConstPtr
shared_ptr< const OrganizedPlaneDetector > ConstPtr
Definition: organized_plane_detector.h:62
pcl::gpu::DeviceArray2D
DeviceArray2D class
Definition: device_array.h:153
pcl::gpu::people::OrganizedPlaneDetector::HostLabelProbability
pcl::PointCloud< pcl::device::prob_histogram > HostLabelProbability
Definition: organized_plane_detector.h:67
pcl::PointCloud< pcl::device::prob_histogram >
pcl::gpu::people::OrganizedPlaneDetector::P_l_host_prev_
HostLabelProbability P_l_host_prev_
Definition: organized_plane_detector.h:74
pcl::gpu::people::OrganizedPlaneDetector::copyHostLabelProbability
int copyHostLabelProbability(HostLabelProbability &src, HostLabelProbability &dst)
pcl::gpu::people::OrganizedPlaneDetector::setMpsDistanceThreshold
void setMpsDistanceThreshold(double mpsDistanceThreshold)
Definition: organized_plane_detector.h:114
pcl::gpu::people::OrganizedPlaneDetector::mps_
pcl::OrganizedMultiPlaneSegmentation< PointTC, pcl::Normal, pcl::Label > mps_
Definition: organized_plane_detector.h:81
pcl::gpu::people::OrganizedPlaneDetector::getNeMaxDepthChangeFactor
float getNeMaxDepthChangeFactor() const
Definition: organized_plane_detector.h:133
pcl::gpu::people::OrganizedPlaneDetector::mps_DistanceThreshold_
double mps_DistanceThreshold_
Definition: organized_plane_detector.h:88
pcl::OrganizedMultiPlaneSegmentation
OrganizedMultiPlaneSegmentation finds all planes present in the input cloud, and outputs a vector of ...
Definition: organized_multi_plane_segmentation.h:63
pcl::PointXYZRGBA
A point structure representing Euclidean xyz coordinates, and the RGBA color.
Definition: point_types.hpp:553
pcl::gpu::people::OrganizedPlaneDetector::mps_use_planar_refinement_
bool mps_use_planar_refinement_
Definition: organized_plane_detector.h:89
pcl::gpu::people::OrganizedPlaneDetector::getMpsDistanceThreshold
double getMpsDistanceThreshold() const
Definition: organized_plane_detector.h:109
pcl::gpu::people::OrganizedPlaneDetector::OrganizedPlaneDetector
OrganizedPlaneDetector(int rows=480, int cols=640)
This is the constructor.
pcl::gpu::people::OrganizedPlaneDetector::emptyHostLabelProbability
void emptyHostLabelProbability(HostLabelProbability &histogram)
pcl::gpu::people::OrganizedPlaneDetector::getMpsAngularThreshold
double getMpsAngularThreshold() const
Definition: organized_plane_detector.h:98
pcl::gpu::people::OrganizedPlaneDetector::copyAndClearHostLabelProbability
int copyAndClearHostLabelProbability(HostLabelProbability &src, HostLabelProbability &dst)
pcl::PointXYZ
A point structure representing Euclidean xyz coordinates.
Definition: point_types.hpp:300
pcl::gpu::people::OrganizedPlaneDetector
Definition: organized_plane_detector.h:58
pcl::gpu::people::OrganizedPlaneDetector::getMpsMinInliers
int getMpsMinInliers() const
Definition: organized_plane_detector.h:120
pcl::gpu::people::OrganizedPlaneDetector::process
void process(const PointCloud< PointTC >::ConstPtr &cloud)
Process step, this wraps Organized Plane Segmentation code.
pcl::gpu::people::OrganizedPlaneDetector::P_l_dev_
pcl::device::LabelProbability P_l_dev_
Definition: organized_plane_detector.h:76
pcl::gpu::people::OrganizedPlaneDetector::setMpsAngularThreshold
void setMpsAngularThreshold(double mpsAngularThreshold)
Definition: organized_plane_detector.h:103
pcl::gpu::people::OrganizedPlaneDetector::ne_MaxDepthChangeFactor_
float ne_MaxDepthChangeFactor_
Definition: organized_plane_detector.h:84
pcl::gpu::people::OrganizedPlaneDetector::ne_
pcl::IntegralImageNormalEstimation< PointTC, pcl::Normal > ne_
Definition: organized_plane_detector.h:80
pcl::gpu::people::OrganizedPlaneDetector::P_l_host_
HostLabelProbability P_l_host_
Definition: organized_plane_detector.h:73
pcl::PointCloud::ConstPtr
shared_ptr< const PointCloud< PointT > > ConstPtr
Definition: point_cloud.h:407
pcl::gpu::people::OrganizedPlaneDetector::mps_MinInliers_
int mps_MinInliers_
Definition: organized_plane_detector.h:86
pcl::gpu::people::OrganizedPlaneDetector::ne_NormalSmoothingSize_
float ne_NormalSmoothingSize_
Definition: organized_plane_detector.h:83
memory.h
Defines functions, macros and traits for allocating and using memory.
pcl::gpu::people::OrganizedPlaneDetector::Ptr
shared_ptr< OrganizedPlaneDetector > Ptr
Definition: organized_plane_detector.h:61
pcl::gpu::people::OrganizedPlaneDetector::getNeNormalSmoothingSize
float getNeNormalSmoothingSize() const
Definition: organized_plane_detector.h:144