Point Cloud Library (PCL)  1.8.1
people_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 #ifndef PCL_GPU_PEOPLE_PERSON_H_
38 #define PCL_GPU_PEOPLE_PERSON_H_
39 
40 #include <iostream>
41 #include <sstream>
42 #include <fstream>
43 
44 #include <pcl/point_types.h>
45 #include <pcl/console/print.h>
46 #include <pcl/gpu/containers/device_array.h>
47 #include <pcl/gpu/people/label_common.h>
48 #include <pcl/gpu/people/tree.h>
49 #include <pcl/gpu/people/person_attribs.h>
50 //#include <opencv2/core/core.hpp>
51 
52 #include <pcl/gpu/people/bodyparts_detector.h>
53 #include <pcl/gpu/people/face_detector.h>
54 #include <pcl/gpu/people/organized_plane_detector.h>
55 #include <pcl/gpu/people/probability_processor.h>
56 
57 namespace pcl
58 {
59  namespace gpu
60  {
61  namespace people
62  {
63  /*
64  struct OtherDetector
65  {
66  typedef boost::shared_ptr<OtherDetector> Ptr;
67  };
68  */
69  class PCL_EXPORTS PeopleDetector
70  {
71  public:
72  typedef boost::shared_ptr<PeopleDetector> Ptr;
73 
78 
79  // ALL THE DETECTOR OBJECTS
83  //OtherDetector::Ptr other_detector_;
84 
85  // ALL THE OTHER PEOPLE STUFF
88 
89  /** \brief Class constructor. */
90  PeopleDetector ();
91 
92  /** \brief Class destructor. */
94 
95  /** \brief User must set non standard intrinsics */
96  void
97  setIntrinsics (float fx, float fy, float cx = -1, float cy = -1);
98 
99  /** \brief Possible will be removed because of extra overheads */
100  int
101  process (const PointCloud<PointTC>::ConstPtr &cloud);
102 
103  int
104  processProb (const PointCloud<PointTC>::ConstPtr &cloud);
105 
106  int
107  process (const Depth& depth, const Image& rgba);
108 
109  /** \brief Set the tolerance for the delta on the Hue in Seeded Hue Segmentation step */
110  inline void
111  setDeltaHueTolerance (unsigned int delta_hue_tolerance)
112  {
113  delta_hue_tolerance_ = delta_hue_tolerance;
114  }
115 
116  /** \brief Get the tolerance for the delta on the Hue in Seeded Hue Segmentation step, defaults to 5 */
117  inline unsigned int
119  {
120  return (delta_hue_tolerance_);
121  }
122 
123  /** \brief Class getName method. */
124  inline const std::string getClassName () const { return "PeopleDetector"; }
125 
129 
130  /** \brief indicates first time callback (allows for tracking features to start from second frame) **/
132  float fx_, fy_, cx_, cy_;
133  unsigned int delta_hue_tolerance_;
134 
136 
142 
144 
146 
149 
152 
153  int
154  process ();
155 
156  /**
157  * \brief Process the depth based on probabilities supporting tracking, person specific files used
158  **/
159  int
160  processProb ();
161 
162  void
163  allocate_buffers (int rows = 480, int cols = 640);
164 
165  void
166  shs5 (const pcl::PointCloud<PointT> &cloud, const std::vector<int>& indices, unsigned char *mask);
167 
168  //!!! only for debug purposes TODO: remove this.
169  friend class PeoplePCDApp;
170  };
171  }
172  }
173 }
174 #endif // PCL_GPU_PEOPLE_PERSON_H_
void setDeltaHueTolerance(unsigned int delta_hue_tolerance)
Set the tolerance for the delta on the Hue in Seeded Hue Segmentation step.
bool first_iteration_
indicates first time callback (allows for tracking features to start from second frame) ...
DeviceArray2D< unsigned char > Labels
ProbabilityProcessor::Ptr probability_processor_
PointCloud< unsigned short > depth_host_
PointCloud< PointTC > cloud_host_color_
DeviceArray2D< pcl::RGB > Image
const std::string getClassName() const
Class getName method.
DeviceArray< unsigned char > kernelRect5x5_
DeviceArray2D< unsigned char > Mask
boost::shared_ptr< FaceDetector > Ptr
Definition: face_detector.h:61
A point structure representing Euclidean xyz coordinates, and the RGBA color.
unsigned int getDeltaHueTolerance() const
Get the tolerance for the delta on the Hue in Seeded Hue Segmentation step, defaults to 5...
boost::shared_ptr< RDFBodyPartsDetector > Ptr
DeviceArray2D< PointT > cloud_device_
PersonAttribs::Ptr person_attribs_
PointCloud< unsigned char > flowermat_host_
Defines all the PCL implemented PointT point type structures.
A point structure representing Euclidean xyz coordinates.
boost::shared_ptr< const PointCloud< PointT > > ConstPtr
Definition: point_cloud.h:429
boost::shared_ptr< PeopleDetector > Ptr
PointCloud represents the base class in PCL for storing collections of 3D points. ...
~PeopleDetector()
Class destructor.
OrganizedPlaneDetector::Ptr org_plane_detector_
PointCloud< PointT > cloud_host_
RDFBodyPartsDetector::Ptr rdf_detector_
boost::shared_ptr< PersonAttribs > Ptr
DeviceArray2D< unsigned short > Depth
boost::shared_ptr< OrganizedPlaneDetector > Ptr
boost::shared_ptr< ProbabilityProcessor > Ptr