Point Cloud Library (PCL)  1.11.1-dev
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 }
pcl
Definition: convolution.h:46
point_types.h
pcl::gpu::people::PeopleDetector::org_plane_detector_
OrganizedPlaneDetector::Ptr org_plane_detector_
Definition: people_detector.h:75
pcl::gpu::people::PeopleDetector::~PeopleDetector
~PeopleDetector()
Class destructor.
Definition: people_detector.h:87
pcl::gpu::DeviceArray2D< unsigned short >
pcl::gpu::people::ProbabilityProcessor::Ptr
shared_ptr< ProbabilityProcessor > Ptr
Definition: probability_processor.h:63
pcl::gpu::people::PeopleDetector::rdf_detector_
RDFBodyPartsDetector::Ptr rdf_detector_
Definition: people_detector.h:74
pcl::PointCloud
PointCloud represents the base class in PCL for storing collections of 3D points.
Definition: distances.h:55
pcl::gpu::people::PeopleDetector::fy_
float fy_
Definition: people_detector.h:126
pcl::gpu::people::PeopleDetector::cloud_host_
PointCloud< PointT > cloud_host_
Definition: people_detector.h:131
pcl::gpu::people::PeopleDetector::face_detector_
FaceDetector::Ptr face_detector_
Definition: people_detector.h:76
pcl::gpu::people::PeopleDetector
Definition: people_detector.h:62
pcl::PointXYZRGBA
A point structure representing Euclidean xyz coordinates, and the RGBA color.
Definition: point_types.hpp:553
pcl::gpu::people::PeopleDetector::setDeltaHueTolerance
void setDeltaHueTolerance(unsigned int delta_hue_tolerance)
Set the tolerance for the delta on the Hue in Seeded Hue Segmentation step.
Definition: people_detector.h:105
pcl::gpu::people::PeopleDetector::depth_device1_
Depth depth_device1_
Definition: people_detector.h:141
pcl::PointXYZ
A point structure representing Euclidean xyz coordinates.
Definition: point_types.hpp:300
pcl::gpu::people::PeopleDetector::hue_host_
PointCloud< float > hue_host_
Definition: people_detector.h:133
pcl::gpu::people::PeopleDetector::ConstPtr
shared_ptr< const PeopleDetector > ConstPtr
Definition: people_detector.h:66
pcl::gpu::people::RDFBodyPartsDetector::Ptr
shared_ptr< RDFBodyPartsDetector > Ptr
Definition: bodyparts_detector.h:67
pcl::gpu::DeviceArray< unsigned char >
pcl::gpu::people::PeopleDetector::first_iteration_
bool first_iteration_
indicates first time callback (allows for tracking features to start from second frame)
Definition: people_detector.h:125
pcl::gpu::people::PeopleDetector::fg_mask_grown_
Mask fg_mask_grown_
Definition: people_detector.h:145
pcl::gpu::people::PeopleDetector::probability_processor_
ProbabilityProcessor::Ptr probability_processor_
Definition: people_detector.h:81
pcl::gpu::people::FaceDetector::Ptr
shared_ptr< FaceDetector > Ptr
Definition: face_detector.h:61
pcl::gpu::people::PeopleDetector::depth_host_
PointCloud< unsigned short > depth_host_
Definition: people_detector.h:134
pcl::gpu::people::PeopleDetector::hue_device_
Hue hue_device_
Definition: people_detector.h:139
pcl::gpu::people::PeopleDetector::getClassName
const std::string getClassName() const
Class getName method.
Definition: people_detector.h:118
pcl::gpu::people::PeopleDetector::Ptr
shared_ptr< PeopleDetector > Ptr
Definition: people_detector.h:65
pcl::gpu::people::PeopleDetector::cloud_host_color_
PointCloud< PointTC > cloud_host_color_
Definition: people_detector.h:132
pcl::gpu::people::PeopleDetector::depth_device2_
Depth depth_device2_
Definition: people_detector.h:142
pcl::gpu::people::PeopleDetector::kernelRect5x5_
DeviceArray< unsigned char > kernelRect5x5_
Definition: people_detector.h:129
pcl::PointCloud::ConstPtr
shared_ptr< const PointCloud< PointT > > ConstPtr
Definition: point_cloud.h:407
pcl::gpu::people::PeopleDetector::fg_mask_
Mask fg_mask_
Definition: people_detector.h:144
pcl::gpu::people::PersonAttribs::Ptr
shared_ptr< PersonAttribs > Ptr
Definition: person_attribs.h:19
pcl::gpu::people::PeopleDetector::getDeltaHueTolerance
unsigned int getDeltaHueTolerance() const
Get the tolerance for the delta on the Hue in Seeded Hue Segmentation step, defaults to 5.
Definition: people_detector.h:112
pcl::gpu::people::PeopleDetector::cloud_device_
DeviceArray2D< PointT > cloud_device_
Definition: people_detector.h:137
pcl::gpu::people::PeopleDetector::person_attribs_
PersonAttribs::Ptr person_attribs_
Definition: people_detector.h:80
pcl::gpu::people::PeopleDetector::delta_hue_tolerance_
unsigned int delta_hue_tolerance_
Definition: people_detector.h:127
PCL_EXPORTS
#define PCL_EXPORTS
Definition: pcl_macros.h:323
pcl::gpu::people::OrganizedPlaneDetector::Ptr
shared_ptr< OrganizedPlaneDetector > Ptr
Definition: organized_plane_detector.h:61
pcl::gpu::people::PeopleDetector::flowermat_host_
PointCloud< unsigned char > flowermat_host_
Definition: people_detector.h:135