Point Cloud Library (PCL) 1.14.0
Loading...
Searching...
No Matches
head_based_subcluster.h
1/*
2 * Software License Agreement (BSD License)
3 *
4 * Point Cloud Library (PCL) - www.pointclouds.org
5 * Copyright (c) 2013-, Open Perception, Inc.
6 *
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 *
13 * * Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * * Redistributions in binary form must reproduce the above
16 * copyright notice, this list of conditions and the following
17 * disclaimer in the documentation and/or other materials provided
18 * with the distribution.
19 * * Neither the name of the copyright holder(s) nor the names of its
20 * contributors may be used to endorse or promote products derived
21 * from this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 *
36 * head_based_subcluster.h
37 * Created on: Nov 30, 2012
38 * Author: Matteo Munaro
39 */
40
41#pragma once
42
43#include <pcl/people/person_cluster.h>
44#include <pcl/people/height_map_2d.h>
45#include <pcl/point_types.h>
46
47namespace pcl
48{
49 namespace people
50 {
51 /** \brief @b HeadBasedSubclustering represents a class for searching for people inside a HeightMap2D based on a 3D head detection algorithm
52 * \author Matteo Munaro
53 * \ingroup people
54 */
55 template <typename PointT> class HeadBasedSubclustering;
56
57 template <typename PointT>
59 {
60 public:
61
65
66 /** \brief Constructor. */
68
69 /** \brief Destructor. */
71
72 /**
73 * \brief Compute subclusters and return them into a vector of PersonCluster.
74 *
75 * \param[in] clusters Vector of PersonCluster.
76 */
77 void
78 subcluster (std::vector<pcl::people::PersonCluster<PointT> >& clusters);
79
80 /**
81 * \brief Merge clusters close in floor coordinates.
82 *
83 * \param[in] input_clusters Input vector of PersonCluster.
84 * \param[in] output_clusters Output vector of PersonCluster (after merging).
85 */
86 void
88 std::vector<pcl::people::PersonCluster<PointT> >& output_clusters);
89
90 /**
91 * \brief Create subclusters centered on the heads position from the current cluster.
92 *
93 * \param[in] cluster A PersonCluster.
94 * \param[in] maxima_number_after_filtering Number of local maxima to use as centers of the new cluster.
95 * \param[in] maxima_cloud_indices_filtered Cloud indices of local maxima to use as centers of the new cluster.
96 * \param[out] subclusters Output vector of PersonCluster objects derived from the input cluster.
97 */
98 void
99 createSubClusters (pcl::people::PersonCluster<PointT>& cluster, int maxima_number_after_filtering, std::vector<int>& maxima_cloud_indices_filtered,
100 std::vector<pcl::people::PersonCluster<PointT> >& subclusters);
101
102 /**
103 * \brief Set input cloud.
104 *
105 * \param[in] cloud A pointer to the input point cloud.
106 */
107 void
109
110 /**
111 * \brief Set the ground coefficients.
112 *
113 * \param[in] ground_coeffs The ground plane coefficients.
114 */
115 void
116 setGround (Eigen::VectorXf& ground_coeffs);
117
118 /**
119 * \brief Set sensor orientation to landscape mode (false) or portrait mode (true).
120 *
121 * \param[in] vertical Landscape (false) or portrait (true) mode (default = false).
122 */
123 void
124 setSensorPortraitOrientation (bool vertical);
125
126 /**
127 * \brief Set head_centroid_ to true (person centroid is in the head) or false (person centroid is the whole body centroid).
128 *
129 * \param[in] head_centroid Set the location of the person centroid (head or body center) (default = true).
130 */
131 void
132 setHeadCentroid (bool head_centroid);
133
134 /**
135 * \brief Set initial cluster indices.
136 *
137 * \param[in] cluster_indices Point cloud indices corresponding to the initial clusters (before subclustering).
138 */
139 void
140 setInitialClusters (std::vector<pcl::PointIndices>& cluster_indices);
141
142 /**
143 * \brief Set minimum and maximum allowed height for a person cluster.
144 *
145 * \param[in] min_height Minimum allowed height for a person cluster (default = 1.3).
146 * \param[in] max_height Maximum allowed height for a person cluster (default = 2.3).
147 */
148 void
149 setHeightLimits (float min_height, float max_height);
150
151 /**
152 * \brief Set minimum and maximum allowed number of points for a person cluster.
153 *
154 * \param[in] min_points Minimum allowed number of points for a person cluster.
155 * \param[in] max_points Maximum allowed number of points for a person cluster.
156 */
157 void
158 setDimensionLimits (int min_points, int max_points);
159
160 /**
161 * \brief Set minimum distance between persons' heads.
162 *
163 * \param[in] heads_minimum_distance Minimum allowed distance between persons' heads (default = 0.3).
164 */
165 void
166 setMinimumDistanceBetweenHeads (float heads_minimum_distance);
167
168 /**
169 * \brief Get minimum and maximum allowed height for a person cluster.
170 *
171 * \param[out] min_height Minimum allowed height for a person cluster.
172 * \param[out] max_height Maximum allowed height for a person cluster.
173 */
174 void
175 getHeightLimits (float& min_height, float& max_height);
176
177 /**
178 * \brief Get minimum and maximum allowed number of points for a person cluster.
179 *
180 * \param[out] min_points Minimum allowed number of points for a person cluster.
181 * \param[out] max_points Maximum allowed number of points for a person cluster.
182 */
183 void
184 getDimensionLimits (int& min_points, int& max_points);
185
186 /**
187 * \brief Get minimum distance between persons' heads.
188 */
189 float
191
192 protected:
193 /** \brief ground plane coefficients */
194 Eigen::VectorXf ground_coeffs_;
195
196 /** \brief ground plane normalization factor */
198
199 /** \brief initial clusters indices */
200 std::vector<pcl::PointIndices> cluster_indices_;
201
202 /** \brief pointer to the input cloud */
204
205 /** \brief person clusters maximum height from the ground plane */
207
208 /** \brief person clusters minimum height from the ground plane */
210
211 /** \brief if true, the sensor is considered to be vertically placed (portrait mode) */
213
214 /** \brief if true, the person centroid is computed as the centroid of the cluster points belonging to the head
215 if false, the person centroid is computed as the centroid of the whole cluster points (default = true) */
217
218 /** \brief maximum number of points for a person cluster */
220
221 /** \brief minimum number of points for a person cluster */
223
224 /** \brief minimum distance between persons' heads */
226 };
227 } /* namespace people */
228} /* namespace pcl */
229#include <pcl/people/impl/head_based_subcluster.hpp>
PointCloud represents the base class in PCL for storing collections of 3D points.
shared_ptr< PointCloud< PointT > > Ptr
shared_ptr< const PointCloud< PointT > > ConstPtr
HeadBasedSubclustering represents a class for searching for people inside a HeightMap2D based on a 3D...
void setGround(Eigen::VectorXf &ground_coeffs)
Set the ground coefficients.
bool vertical_
if true, the sensor is considered to be vertically placed (portrait mode)
std::vector< pcl::PointIndices > cluster_indices_
initial clusters indices
void setDimensionLimits(int min_points, int max_points)
Set minimum and maximum allowed number of points for a person cluster.
virtual ~HeadBasedSubclustering()
Destructor.
void setHeadCentroid(bool head_centroid)
Set head_centroid_ to true (person centroid is in the head) or false (person centroid is the whole bo...
void subcluster(std::vector< pcl::people::PersonCluster< PointT > > &clusters)
Compute subclusters and return them into a vector of PersonCluster.
bool head_centroid_
if true, the person centroid is computed as the centroid of the cluster points belonging to the head ...
float min_height_
person clusters minimum height from the ground plane
void mergeClustersCloseInFloorCoordinates(std::vector< pcl::people::PersonCluster< PointT > > &input_clusters, std::vector< pcl::people::PersonCluster< PointT > > &output_clusters)
Merge clusters close in floor coordinates.
PointCloudPtr cloud_
pointer to the input cloud
Eigen::VectorXf ground_coeffs_
ground plane coefficients
void getHeightLimits(float &min_height, float &max_height)
Get minimum and maximum allowed height for a person cluster.
void setInitialClusters(std::vector< pcl::PointIndices > &cluster_indices)
Set initial cluster indices.
void setMinimumDistanceBetweenHeads(float heads_minimum_distance)
Set minimum distance between persons' heads.
void getDimensionLimits(int &min_points, int &max_points)
Get minimum and maximum allowed number of points for a person cluster.
float getMinimumDistanceBetweenHeads()
Get minimum distance between persons' heads.
void setSensorPortraitOrientation(bool vertical)
Set sensor orientation to landscape mode (false) or portrait mode (true).
typename PointCloud::ConstPtr PointCloudConstPtr
int min_points_
minimum number of points for a person cluster
void setHeightLimits(float min_height, float max_height)
Set minimum and maximum allowed height for a person cluster.
float sqrt_ground_coeffs_
ground plane normalization factor
int max_points_
maximum number of points for a person cluster
float max_height_
person clusters maximum height from the ground plane
void createSubClusters(pcl::people::PersonCluster< PointT > &cluster, int maxima_number_after_filtering, std::vector< int > &maxima_cloud_indices_filtered, std::vector< pcl::people::PersonCluster< PointT > > &subclusters)
Create subclusters centered on the heads position from the current cluster.
float heads_minimum_distance_
minimum distance between persons' heads
void setInputCloud(PointCloudPtr &cloud)
Set input cloud.
PersonCluster represents a class for representing information about a cluster containing a person.
Defines all the PCL implemented PointT point type structures.