Point Cloud Library (PCL)  1.11.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 #pragma once
38 
39 #include <iostream>
40 #include <sstream>
41 #include <fstream>
42 
43 #include <pcl/point_types.h>
44 #include <pcl/console/print.h>
45 #include <pcl/gpu/containers/device_array.h>
46 #include <pcl/gpu/people/label_common.h>
47 #include <pcl/gpu/people/tree.h>
48 #include <pcl/gpu/people/person_attribs.h>
49 //#include <opencv2/core/core.hpp>
50 
51 #include <pcl/gpu/people/bodyparts_detector.h>
52 #include <pcl/gpu/people/face_detector.h>
53 #include <pcl/gpu/people/organized_plane_detector.h>
54 #include <pcl/gpu/people/probability_processor.h>
55 
56 namespace pcl
57 {
58  namespace gpu
59  {
60  namespace people
61  {
63  {
64  public:
65  using Ptr = shared_ptr<PeopleDetector>;
66  using ConstPtr = shared_ptr<const PeopleDetector>;
67 
72 
73  // ALL THE DETECTOR OBJECTS
77  //OtherDetector::Ptr other_detector_;
78 
79  // ALL THE OTHER PEOPLE STUFF
82 
83  /** \brief Class constructor. */
84  PeopleDetector ();
85 
86  /** \brief Class destructor. */
88 
89  /** \brief User must set non standard intrinsics */
90  void
91  setIntrinsics (float fx, float fy, float cx = -1, float cy = -1);
92 
93  /** \brief Possible will be removed because of extra overheads */
94  int
95  process (const PointCloud<PointTC>::ConstPtr &cloud);
96 
97  int
98  processProb (const PointCloud<PointTC>::ConstPtr &cloud);
99 
100  int
101  process (const Depth& depth, const Image& rgba);
102 
103  /** \brief Set the tolerance for the delta on the Hue in Seeded Hue Segmentation step */
104  inline void
105  setDeltaHueTolerance (unsigned int delta_hue_tolerance)
106  {
107  delta_hue_tolerance_ = delta_hue_tolerance;
108  }
109 
110  /** \brief Get the tolerance for the delta on the Hue in Seeded Hue Segmentation step, defaults to 5 */
111  inline unsigned int
113  {
114  return (delta_hue_tolerance_);
115  }
116 
117  /** \brief Class getName method. */
118  inline const std::string getClassName () const { return "PeopleDetector"; }
119 
123 
124  /** \brief indicates first time callback (allows for tracking features to start from second frame) **/
126  float fx_, fy_, cx_, cy_;
127  unsigned int delta_hue_tolerance_;
128 
130 
136 
138 
140 
143 
146 
147  int
148  process ();
149 
150  /**
151  * \brief Process the depth based on probabilities supporting tracking, person specific files used
152  **/
153  int
154  processProb ();
155 
156  void
157  allocate_buffers (int rows = 480, int cols = 640);
158 
159  void
160  shs5 (const pcl::PointCloud<PointT> &cloud, const std::vector<int>& indices, unsigned char *mask);
161 
162  //!!! only for debug purposes TODO: remove this.
163  friend class PeoplePCDApp;
164  };
165  }
166  }
167 }
shared_ptr< PersonAttribs > Ptr
shared_ptr< FaceDetector > Ptr
Definition: face_detector.h:61
void setDeltaHueTolerance(unsigned int delta_hue_tolerance)
Set the tolerance for the delta on the Hue in Seeded Hue Segmentation step.
shared_ptr< ProbabilityProcessor > Ptr
bool first_iteration_
indicates first time callback (allows for tracking features to start from second frame) ...
ProbabilityProcessor::Ptr probability_processor_
PointCloud< unsigned short > depth_host_
shared_ptr< OrganizedPlaneDetector > Ptr
PointCloud< PointTC > cloud_host_color_
const std::string getClassName() const
Class getName method.
DeviceArray< unsigned char > kernelRect5x5_
shared_ptr< PeopleDetector > Ptr
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...
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.
PointCloud represents the base class in PCL for storing collections of 3D points. ...
Definition: distances.h:55
~PeopleDetector()
Class destructor.
OrganizedPlaneDetector::Ptr org_plane_detector_
shared_ptr< const PointCloud< PointT > > ConstPtr
Definition: point_cloud.h:430
PointCloud< PointT > cloud_host_
RDFBodyPartsDetector::Ptr rdf_detector_
#define PCL_EXPORTS
Definition: pcl_macros.h:328
shared_ptr< const PeopleDetector > ConstPtr
shared_ptr< RDFBodyPartsDetector > Ptr