Point Cloud Library (PCL) 1.13.0
Loading...
Searching...
No Matches
height_map_2d.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 * height_map_2d.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/point_types.h>
45
46namespace pcl
47{
48 namespace people
49 {
50 /** \brief @b HeightMap2D represents a class for creating a 2D height map from a point cloud and searching for its local maxima
51 * \author Matteo Munaro
52 * \ingroup people
53 */
54 template <typename PointT> class HeightMap2D;
55
56 template <typename PointT>
58 {
59 public:
60
64
65 /** \brief Constructor. */
67
68 /** \brief Destructor. */
69 virtual ~HeightMap2D ();
70
71 /**
72 * \brief Compute the height map with the projection of cluster points onto the ground plane.
73 *
74 * \param[in] cluster The PersonCluster used to compute the height map.
75 */
76 void
78
79 /**
80 * \brief Compute local maxima of the height map.
81 */
82 void
84
85 /**
86 * \brief Filter maxima of the height map by imposing a minimum distance between them.
87 */
88 void
89 filterMaxima ();
90
91 /**
92 * \brief Set initial cluster indices.
93 *
94 * \param[in] cloud A pointer to the input cloud.
95 */
96 void
98
99 /**
100 * \brief Set the ground coefficients.
101 *
102 * \param[in] ground_coeffs The ground plane coefficients.
103 */
104 void
105 setGround (Eigen::VectorXf& ground_coeffs);
106
107 /**
108 * \brief Set bin size for the height map.
109 *
110 * \param[in] bin_size Bin size for the height map (default = 0.06).
111 */
112 void
113 setBinSize (float bin_size);
114
115 /**
116 * \brief Set minimum distance between maxima.
117 *
118 * \param[in] minimum_distance_between_maxima Minimum allowed distance between maxima (default = 0.3).
119 */
120 void
121 setMinimumDistanceBetweenMaxima (float minimum_distance_between_maxima);
122
123 /**
124 * \brief Set sensor orientation to landscape mode (false) or portrait mode (true).
125 *
126 * \param[in] vertical Landscape (false) or portrait (true) mode (default = false).
127 */
128 void
129 setSensorPortraitOrientation (bool vertical);
130
131 /**
132 * \brief Get the height map as a vector of int.
133 */
134 std::vector<int>&
135 getHeightMap ();
136
137 /**
138 * \brief Get bin size for the height map.
139 */
140 float
141 getBinSize ();
142
143 /**
144 * \brief Get minimum distance between maxima of the height map.
145 */
146 float
148
149 /**
150 * \brief Return the maxima number after the filterMaxima method.
151 */
152 int&
154
155 /**
156 * \brief Return the point cloud indices corresponding to the maxima computed after the filterMaxima method.
157 */
158 std::vector<int>&
160
161 protected:
162 /** \brief ground plane coefficients */
163 Eigen::VectorXf ground_coeffs_;
164
165 /** \brief ground plane normalization factor */
167
168 /** \brief pointer to the input cloud */
170
171 /** \brief if true, the sensor is considered to be vertically placed (portrait mode) */
173
174 /** \brief vector with maximum height values for every bin (height map) */
175 std::vector<int> buckets_;
176
177 /** \brief indices of the pointcloud points with maximum height for every bin */
178 std::vector<int> buckets_cloud_indices_;
179
180 /** \brief bin dimension */
181 float bin_size_;
182
183 /** \brief number of local maxima in the height map */
185
186 /** \brief contains the position of the maxima in the buckets vector */
187 std::vector<int> maxima_indices_;
188
189 /** \brief contains the point cloud position of the maxima (indices of the point cloud) */
190 std::vector<int> maxima_cloud_indices_;
191
192 /** \brief number of local maxima after filtering */
194
195 /** \brief contains the position of the maxima in the buckets array after filtering */
196 std::vector<int> maxima_indices_filtered_;
197
198 /** \brief contains the point cloud position of the maxima after filtering */
200
201 /** \brief minimum allowed distance between maxima */
203 };
204
205 } /* namespace people */
206} /* namespace pcl */
207#include <pcl/people/impl/height_map_2d.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
HeightMap2D represents a class for creating a 2D height map from a point cloud and searching for its ...
void filterMaxima()
Filter maxima of the height map by imposing a minimum distance between them.
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.
typename PointCloud::ConstPtr PointCloudConstPtr
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.
Defines all the PCL implemented PointT point type structures.