41#include <pcl/people/height_map_2d.h>
43#ifndef PCL_PEOPLE_HEIGHT_MAP_2D_HPP_
44#define PCL_PEOPLE_HEIGHT_MAP_2D_HPP_
46template <
typename Po
intT>
58template <
typename Po
intT>
void
64 PCL_ERROR (
"[pcl::people::HeightMap2D::compute] Floor parameters have not been set or they are not valid!\n");
69 PCL_ERROR (
"[pcl::people::HeightMap2D::compute] Input cloud has not been set!\n");
90 PointT* p = &(*cloud_)[cluster_idx];
96 if (index > (
static_cast<int> (
buckets_.size ()) - 1))
97 std::cout <<
"Error: out of array - " << index <<
" of " <<
buckets_.size() << std::endl;
100 Eigen::Vector4f new_point(p->x, p->y, p->z, 1.0f);
103 if ((heightp * 60) >
buckets_[index])
118template <
typename Po
intT>
void
138 while (i < (
static_cast<int> (
buckets_.size()) - 1))
201template <
typename Po
intT>
void
212 bool good_maximum =
true;
215 Eigen::Vector3f p_current_eigen(p_current->x, p_current->y, p_current->z);
220 while ((j >= 0) && (good_maximum))
223 Eigen::Vector3f p_previous_eigen(p_previous->x, p_previous->y, p_previous->z);
228 float distance = (p_current_eigen-p_previous_eigen).norm();
231 good_maximum =
false;
245template <
typename Po
intT>
void
251template <
typename Po
intT>
255 sqrt_ground_coeffs_ = (ground_coeffs - Eigen::Vector4f(0.0f, 0.0f, 0.0f, ground_coeffs(3))).norm();
258template <
typename Po
intT>
void
264template <
typename Po
intT>
void
270template <
typename Po
intT>
void
276template <
typename Po
intT> std::vector<int>&
282template <
typename Po
intT>
float
288template <
typename Po
intT>
float
294template <
typename Po
intT>
int&
300template <
typename Po
intT> std::vector<int>&
306template <
typename Po
intT>
void filterMaxima()
Filter maxima of the height map by imposing a minimum distance between them.
HeightMap2D()
Constructor.
PointCloudPtr cloud_
pointer to the input cloud
Eigen::VectorXf ground_coeffs_
ground plane coefficients
std::vector< int > maxima_cloud_indices_filtered_
contains the point cloud position of the maxima after filtering
void searchLocalMaxima()
Compute local maxima of the height map.
float sqrt_ground_coeffs_
ground plane normalization factor
std::vector< int > maxima_indices_
contains the position of the maxima in the buckets vector
typename PointCloud::Ptr PointCloudPtr
std::vector< int > & getMaximaCloudIndicesFiltered()
Return the point cloud indices corresponding to the maxima computed after the filterMaxima method.
std::vector< int > maxima_indices_filtered_
contains the position of the maxima in the buckets array after filtering
int maxima_number_after_filtering_
number of local maxima after filtering
void setBinSize(float bin_size)
Set bin size for the height map.
float min_dist_between_maxima_
minimum allowed distance between maxima
std::vector< int > buckets_cloud_indices_
indices of the pointcloud points with maximum height for every bin
float getBinSize()
Get bin size for the height map.
void setInputCloud(PointCloudPtr &cloud)
Set initial cluster indices.
void setSensorPortraitOrientation(bool vertical)
Set sensor orientation to landscape mode (false) or portrait mode (true).
int & getMaximaNumberAfterFiltering()
Return the maxima number after the filterMaxima method.
bool vertical_
if true, the sensor is considered to be vertically placed (portrait mode)
int maxima_number_
number of local maxima in the height map
void setGround(Eigen::VectorXf &ground_coeffs)
Set the ground coefficients.
virtual ~HeightMap2D()
Destructor.
std::vector< int > & getHeightMap()
Get the height map as a vector of int.
void compute(pcl::people::PersonCluster< PointT > &cluster)
Compute the height map with the projection of cluster points onto the ground plane.
float getMinimumDistanceBetweenMaxima()
Get minimum distance between maxima of the height map.
void setMinimumDistanceBetweenMaxima(float minimum_distance_between_maxima)
Set minimum distance between maxima.
std::vector< int > buckets_
vector with maximum height values for every bin (height map)
float bin_size_
bin dimension
std::vector< int > maxima_cloud_indices_
contains the point cloud position of the maxima (indices of the point cloud)
PersonCluster represents a class for representing information about a cluster containing a person.
pcl::PointIndices & getIndices()
Returns the indices of the point cloud points corresponding to the cluster.
Eigen::Vector3f & getMin()
Returns the point formed by min x, min y and min z.
Eigen::Vector3f & getMax()
Returns the point formed by max x, max y and max z.