41#ifndef PCL_PEOPLE_PERSON_CLUSTER_HPP_
42#define PCL_PEOPLE_PERSON_CLUSTER_HPP_
44#include <pcl/people/person_cluster.h>
46template <
typename Po
intT>
50 const Eigen::VectorXf& ground_coeffs,
51 float sqrt_ground_coeffs,
55 init(input_cloud, indices, ground_coeffs, sqrt_ground_coeffs, head_centroid, vertical);
58template <
typename Po
intT>
void
62 const Eigen::VectorXf& ground_coeffs,
63 float sqrt_ground_coeffs,
90 PointT* p = &(*input_cloud)[index];
124 float height = std::fabs(height_point.dot(ground_coeffs));
125 height /= sqrt_ground_coeffs;
135 float head_threshold_value;
141 PointT* p = &(*input_cloud)[index];
143 if(p->y < head_threshold_value)
157 PointT* p = &(*input_cloud)[index];
159 if(p->x > head_threshold_value)
182 PointT* p = &(*input_cloud)[index];
184 min_x = std::min(p->x, min_x);
185 max_x = std::max(p->x, max_x);
186 min_z = std::min(p->z, min_z);
187 max_z = std::max(p->z, max_z);
191 angle_max_ = std::max(std::atan2(min_z, min_x), std::atan2(max_z, min_x));
192 angle_min_ = std::min(std::atan2(min_z, max_x), std::atan2(max_z, max_x));
195 float t = c_point.dot(ground_coeffs) / std::pow(sqrt_ground_coeffs, 2);
196 float bottom_x =
c_x_ - ground_coeffs(0) * t;
197 float bottom_y =
c_y_ - ground_coeffs(1) * t;
198 float bottom_z =
c_z_ - ground_coeffs(2) * t;
200 tbottom_ = Eigen::Vector3f(bottom_x, bottom_y, bottom_z);
221 PointT* p = &(*input_cloud)[index];
223 min_y = std::min(p->y, min_y);
224 max_y = std::max(p->y, max_y);
225 min_z = std::min(p->z, min_z);
226 max_z = std::max(p->z, max_z);
234 float t = c_point.dot(ground_coeffs) / std::pow(sqrt_ground_coeffs, 2);
235 float bottom_x =
c_x_ - ground_coeffs(0) * t;
236 float bottom_y =
c_y_ - ground_coeffs(1) * t;
237 float bottom_z =
c_z_ - ground_coeffs(2) * t;
239 tbottom_ = Eigen::Vector3f(bottom_x, bottom_y, bottom_z);
260template <
typename Po
intT>
float
266template <
typename Po
intT>
float
269 float sqrt_ground_coeffs = (ground_coeffs - Eigen::Vector4f(0.0f, 0.0f, 0.0f, ground_coeffs(3))).norm();
270 return (
updateHeight(ground_coeffs, sqrt_ground_coeffs));
273template <
typename Po
intT>
float
276 Eigen::Vector4f height_point;
282 float height = std::fabs(height_point.dot(ground_coeffs));
283 height /= sqrt_ground_coeffs;
288template <
typename Po
intT>
float
294template <
typename Po
intT> Eigen::Vector3f&
300template <
typename Po
intT> Eigen::Vector3f&
306template <
typename Po
intT> Eigen::Vector3f&
312template <
typename Po
intT> Eigen::Vector3f&
318template <
typename Po
intT> Eigen::Vector3f&
324template <
typename Po
intT> Eigen::Vector3f&
330template <
typename Po
intT> Eigen::Vector3f&
336template <
typename Po
intT> Eigen::Vector3f&
342template <
typename Po
intT>
float
348template <
typename Po
intT>
354template <
typename Po
intT>
360template <
typename Po
intT>
366template <
typename Po
intT>
372template <
typename Po
intT>
378template <
typename Po
intT>
384template <
typename Po
intT>
394 coeffs.
values.push_back (0.0);
395 coeffs.
values.push_back (0.0);
396 coeffs.
values.push_back (0.0);
397 coeffs.
values.push_back (1.0);
402 coeffs.
values.push_back (0.5);
403 coeffs.
values.push_back (0.5);
407 coeffs.
values.push_back (0.5);
409 coeffs.
values.push_back (0.5);
412 const std::string bbox_name =
"bbox_person_" + std::to_string(person_number);
414 viewer.
addCube (coeffs, bbox_name);
419template <
typename Po
intT>
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.
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.
bool addCube(const pcl::ModelCoefficients &coefficients, const std::string &id="cube", int viewport=0)
Add a cube from a set of given model coefficients.
bool setShapeRenderingProperties(int property, double value, const std::string &id, int viewport=0)
Set the rendering properties of a shape.
bool removeShape(const std::string &id="cloud", int viewport=0)
Removes an added shape from screen (line, polygon, etc.), based on a given ID.
@ PCL_VISUALIZER_COLOR
3 floats (R, G, B) going from 0.0 (dark) to 1.0 (light)
@ PCL_VISUALIZER_LINE_WIDTH
Integer starting from 1.
std::vector< float > values