Point Cloud Library (PCL) 1.12.0
Loading...
Searching...
No Matches
person_cluster.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 * person_cluster.h
37 * Created on: Nov 30, 2012
38 * Author: Matteo Munaro
39 */
40
41#pragma once
42
43#include <pcl/point_types.h>
44#include <pcl/visualization/pcl_visualizer.h>
45
46namespace pcl
47{
48 namespace people
49 {
50 /** \brief @b PersonCluster represents a class for representing information about a cluster containing a person.
51 * \author Filippo Basso, Matteo Munaro
52 * \ingroup people
53 */
54 template <typename PointT> class PersonCluster;
55 template <typename PointT> bool operator<(const PersonCluster<PointT>& c1, const PersonCluster<PointT>& c2);
56
57 template <typename PointT>
59 {
60 protected:
61
63
64 /** \brief Minimum x coordinate of the cluster points. */
65 float min_x_;
66 /** \brief Minimum y coordinate of the cluster points. */
67 float min_y_;
68 /** \brief Minimum z coordinate of the cluster points. */
69 float min_z_;
70
71 /** \brief Maximum x coordinate of the cluster points. */
72 float max_x_;
73 /** \brief Maximum y coordinate of the cluster points. */
74 float max_y_;
75 /** \brief Maximum z coordinate of the cluster points. */
76 float max_z_;
77
78 /** \brief Sum of x coordinates of the cluster points. */
79 float sum_x_;
80 /** \brief Sum of y coordinates of the cluster points. */
81 float sum_y_;
82 /** \brief Sum of z coordinates of the cluster points. */
83 float sum_z_;
84
85 /** \brief Number of cluster points. */
86 int n_;
87
88 /** \brief x coordinate of the cluster centroid. */
89 float c_x_;
90 /** \brief y coordinate of the cluster centroid. */
91 float c_y_;
92 /** \brief z coordinate of the cluster centroid. */
93 float c_z_;
94
95 /** \brief Cluster height from the ground plane. */
96 float height_;
97
98 /** \brief Cluster distance from the sensor. */
99 float distance_;
100 /** \brief Cluster centroid horizontal angle with respect to z axis. */
101 float angle_;
102
103 /** \brief Maximum angle of the cluster points. */
105 /** \brief Minimum angle of the cluster points. */
107
108 /** \brief Cluster top point. */
109 Eigen::Vector3f top_;
110 /** \brief Cluster bottom point. */
111 Eigen::Vector3f bottom_;
112 /** \brief Cluster centroid. */
113 Eigen::Vector3f center_;
114
115 /** \brief Theoretical cluster top. */
116 Eigen::Vector3f ttop_;
117 /** \brief Theoretical cluster bottom (lying on the ground plane). */
118 Eigen::Vector3f tbottom_;
119 /** \brief Theoretical cluster center (between ttop_ and tbottom_). */
120 Eigen::Vector3f tcenter_;
121
122 /** \brief Vector containing the minimum coordinates of the cluster. */
123 Eigen::Vector3f min_;
124 /** \brief Vector containing the maximum coordinates of the cluster. */
125 Eigen::Vector3f max_;
126
127 /** \brief Point cloud indices of the cluster points. */
129
130 /** \brief If true, the sensor is considered to be vertically placed (portrait mode). */
132 /** \brief PersonCluster HOG confidence. */
134
135 public:
136
140
141 /** \brief Constructor. */
144 const pcl::PointIndices& indices,
145 const Eigen::VectorXf& ground_coeffs,
146 float sqrt_ground_coeffs,
147 bool head_centroid,
148 bool vertical = false);
149
150 /** \brief Destructor. */
151 virtual ~PersonCluster ();
152
153 /**
154 * \brief Returns the height of the cluster.
155 * \return the height of the cluster.
156 */
157 float
158 getHeight () const;
159
160 /**
161 * \brief Update the height of the cluster.
162 * \param[in] ground_coeffs The coefficients of the ground plane.
163 * \return the height of the cluster.
164 */
165 float
166 updateHeight (const Eigen::VectorXf& ground_coeffs);
167
168 /**
169 * \brief Update the height of the cluster.
170 * \param[in] ground_coeffs The coefficients of the ground plane.
171 * \param[in] sqrt_ground_coeffs The norm of the vector [a, b, c] where a, b and c are the first
172 * three coefficients of the ground plane (ax + by + cz + d = 0).
173 * \return the height of the cluster.
174 */
175 float
176 updateHeight (const Eigen::VectorXf& ground_coeffs, float sqrt_ground_coeffs);
177
178 /**
179 * \brief Returns the distance of the cluster from the sensor.
180 * \return the distance of the cluster (its centroid) from the sensor without considering the
181 * y dimension.
182 */
183 float
184 getDistance () const;
185
186 /**
187 * \brief Returns the angle formed by the cluster's centroid with respect to the sensor (in radians).
188 * \return the angle formed by the cluster's centroid with respect to the sensor (in radians).
189 */
190 float
191 getAngle () const;
192
193 /**
194 * \brief Returns the minimum angle formed by the cluster with respect to the sensor (in radians).
195 * \return the minimum angle formed by the cluster with respect to the sensor (in radians).
196 */
197 float
198 getAngleMin () const;
199
200 /**
201 * \brief Returns the maximum angle formed by the cluster with respect to the sensor (in radians).
202 * \return the maximum angle formed by the cluster with respect to the sensor (in radians).
203 */
204 float
205 getAngleMax () const;
206
207 /**
208 * \brief Returns the indices of the point cloud points corresponding to the cluster.
209 * \return the indices of the point cloud points corresponding to the cluster.
210 */
212 getIndices ();
213
214 /**
215 * \brief Returns the theoretical top point.
216 * \return the theoretical top point.
217 */
218 Eigen::Vector3f&
219 getTTop ();
220
221 /**
222 * \brief Returns the theoretical bottom point.
223 * \return the theoretical bottom point.
224 */
225 Eigen::Vector3f&
226 getTBottom ();
227
228 /**
229 * \brief Returns the theoretical centroid (at half height).
230 * \return the theoretical centroid (at half height).
231 */
232 Eigen::Vector3f&
233 getTCenter ();
234
235 /**
236 * \brief Returns the top point.
237 * \return the top point.
238 */
239 Eigen::Vector3f&
240 getTop ();
241
242 /**
243 * \brief Returns the bottom point.
244 * \return the bottom point.
245 */
246 Eigen::Vector3f&
247 getBottom ();
248
249 /**
250 * \brief Returns the centroid.
251 * \return the centroid.
252 */
253 Eigen::Vector3f&
254 getCenter ();
255
256 //Eigen::Vector3f& getTMax();
257
258 /**
259 * \brief Returns the point formed by min x, min y and min z.
260 * \return the point formed by min x, min y and min z.
261 */
262 Eigen::Vector3f&
263 getMin ();
264
265 /**
266 * \brief Returns the point formed by max x, max y and max z.
267 * \return the point formed by max x, max y and max z.
268 */
269 Eigen::Vector3f&
270 getMax ();
271
272 /**
273 * \brief Returns the HOG confidence.
274 * \return the HOG confidence.
275 */
276 float
277 getPersonConfidence () const;
278
279 /**
280 * \brief Returns the number of points of the cluster.
281 * \return the number of points of the cluster.
282 */
283 int
284 getNumberPoints () const;
285
286 /**
287 * \brief Sets the cluster height.
288 * \param[in] height
289 */
290 void
291 setHeight (float height);
292
293 /**
294 * \brief Sets the HOG confidence.
295 * \param[in] confidence
296 */
297 void
298 setPersonConfidence (float confidence);
299
300 /**
301 * \brief Draws the theoretical 3D bounding box of the cluster in the PCL visualizer.
302 * \param[in] viewer PCL visualizer.
303 * \param[in] person_number progressive number representing the person.
304 */
305 void
307
308 /**
309 * \brief For sorting purpose: sort by distance.
310 */
312
313 protected:
314
315 /**
316 * \brief PersonCluster initialization.
317 */
318 void init(
320 const pcl::PointIndices& indices,
321 const Eigen::VectorXf& ground_coeffs,
322 float sqrt_ground_coeffs,
323 bool head_centroid,
324 bool vertical);
325
326 };
327 } /* namespace people */
328} /* namespace pcl */
329#include <pcl/people/impl/person_cluster.hpp>
Iterator class for point clouds with or without given indices.
PointCloud represents the base class in PCL for storing collections of 3D points.
shared_ptr< PointCloud< PointT > > Ptr
shared_ptr< const PointCloud< PointT > > ConstPtr
PersonCluster represents a class for representing information about a cluster containing a person.
Eigen::Vector3f min_
Vector containing the minimum coordinates of the cluster.
Eigen::Vector3f center_
Cluster centroid.
float updateHeight(const Eigen::VectorXf &ground_coeffs)
Update the height of the cluster.
float angle_
Cluster centroid horizontal angle with respect to z axis.
float sum_y_
Sum of y coordinates of the cluster points.
Eigen::Vector3f bottom_
Cluster bottom point.
float max_x_
Maximum x coordinate of the cluster points.
float getPersonConfidence() const
Returns the HOG confidence.
float getHeight() const
Returns the height of the cluster.
Eigen::Vector3f & getBottom()
Returns the bottom point.
typename PointCloud::ConstPtr PointCloudConstPtr
float c_x_
x coordinate of the cluster centroid.
float max_y_
Maximum y coordinate of the cluster points.
pcl::PointIndices & getIndices()
Returns the indices of the point cloud points corresponding to the cluster.
void setPersonConfidence(float confidence)
Sets the HOG confidence.
float angle_min_
Minimum angle of the cluster points.
float sum_x_
Sum of x coordinates of the cluster points.
void init(const PointCloudPtr &input_cloud, const pcl::PointIndices &indices, const Eigen::VectorXf &ground_coeffs, float sqrt_ground_coeffs, bool head_centroid, bool vertical)
PersonCluster initialization.
float min_z_
Minimum z coordinate of the cluster points.
int n_
Number of cluster points.
float person_confidence_
PersonCluster HOG confidence.
Eigen::Vector3f & getMin()
Returns the point formed by min x, min y and min z.
Eigen::Vector3f & getCenter()
Returns the centroid.
float getAngleMax() const
Returns the maximum angle formed by the cluster with respect to the sensor (in radians).
Eigen::Vector3f max_
Vector containing the maximum coordinates of the cluster.
float min_y_
Minimum y coordinate of the cluster points.
float distance_
Cluster distance from the sensor.
float c_z_
z coordinate of the cluster centroid.
void setHeight(float height)
Sets the cluster height.
typename PointCloud::Ptr PointCloudPtr
void drawTBoundingBox(pcl::visualization::PCLVisualizer &viewer, int person_number)
Draws the theoretical 3D bounding box of the cluster in the PCL visualizer.
Eigen::Vector3f & getTBottom()
Returns the theoretical bottom point.
bool vertical_
If true, the sensor is considered to be vertically placed (portrait mode).
Eigen::Vector3f & getTTop()
Returns the theoretical top point.
float getAngleMin() const
Returns the minimum angle formed by the cluster with respect to the sensor (in radians).
float angle_max_
Maximum angle of the cluster points.
float max_z_
Maximum z coordinate of the cluster points.
Eigen::Vector3f tcenter_
Theoretical cluster center (between ttop_ and tbottom_).
Eigen::Vector3f ttop_
Theoretical cluster top.
virtual ~PersonCluster()
Destructor.
float height_
Cluster height from the ground plane.
PersonCluster(const PointCloudPtr &input_cloud, const pcl::PointIndices &indices, const Eigen::VectorXf &ground_coeffs, float sqrt_ground_coeffs, bool head_centroid, bool vertical=false)
Constructor.
Eigen::Vector3f top_
Cluster top point.
Eigen::Vector3f & getTop()
Returns the top point.
float getDistance() const
Returns the distance of the cluster from the sensor.
pcl::PointIndices points_indices_
Point cloud indices of the cluster points.
float min_x_
Minimum x coordinate of the cluster points.
float getAngle() const
Returns the angle formed by the cluster's centroid with respect to the sensor (in radians).
Eigen::Vector3f & getMax()
Returns the point formed by max x, max y and max z.
Eigen::Vector3f & getTCenter()
Returns the theoretical centroid (at half height).
float sum_z_
Sum of z coordinates of the cluster points.
int getNumberPoints() const
Returns the number of points of the cluster.
Eigen::Vector3f tbottom_
Theoretical cluster bottom (lying on the ground plane).
float c_y_
y coordinate of the cluster centroid.
PCL Visualizer main class.
Defines all the PCL implemented PointT point type structures.
bool operator<(const PersonCluster< PointT > &c1, const PersonCluster< PointT > &c2)