Point Cloud Library (PCL)  1.9.1-dev
voxel_grid.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2010-2011, Willow Garage, 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  * $Id$
37  *
38  */
39 
40 #pragma once
41 
42 #include <pcl/filters/boost.h>
43 #include <pcl/filters/filter.h>
44 #include <map>
45 
46 namespace pcl
47 {
48  /** \brief Obtain the maximum and minimum points in 3D from a given point cloud.
49  * \param[in] cloud the pointer to a pcl::PCLPointCloud2 dataset
50  * \param[in] x_idx the index of the X channel
51  * \param[in] y_idx the index of the Y channel
52  * \param[in] z_idx the index of the Z channel
53  * \param[out] min_pt the minimum data point
54  * \param[out] max_pt the maximum data point
55  */
56  PCL_EXPORTS void
57  getMinMax3D (const pcl::PCLPointCloud2ConstPtr &cloud, int x_idx, int y_idx, int z_idx,
58  Eigen::Vector4f &min_pt, Eigen::Vector4f &max_pt);
59 
60  /** \brief Obtain the maximum and minimum points in 3D from a given point cloud.
61  * \note Performs internal data filtering as well.
62  * \param[in] cloud the pointer to a pcl::PCLPointCloud2 dataset
63  * \param[in] x_idx the index of the X channel
64  * \param[in] y_idx the index of the Y channel
65  * \param[in] z_idx the index of the Z channel
66  * \param[in] distance_field_name the name of the dimension to filter data along to
67  * \param[in] min_distance the minimum acceptable value in \a distance_field_name data
68  * \param[in] max_distance the maximum acceptable value in \a distance_field_name data
69  * \param[out] min_pt the minimum data point
70  * \param[out] max_pt the maximum data point
71  * \param[in] limit_negative \b false if data \b inside of the [min_distance; max_distance] interval should be
72  * considered, \b true otherwise.
73  */
74  PCL_EXPORTS void
75  getMinMax3D (const pcl::PCLPointCloud2ConstPtr &cloud, int x_idx, int y_idx, int z_idx,
76  const std::string &distance_field_name, float min_distance, float max_distance,
77  Eigen::Vector4f &min_pt, Eigen::Vector4f &max_pt, bool limit_negative = false);
78 
79  /** \brief Get the relative cell indices of the "upper half" 13 neighbors.
80  * \note Useful in combination with getNeighborCentroidIndices() from \ref VoxelGrid
81  * \ingroup filters
82  */
83  inline Eigen::MatrixXi
85  {
86  Eigen::MatrixXi relative_coordinates (3, 13);
87  int idx = 0;
88 
89  // 0 - 8
90  for (int i = -1; i < 2; i++)
91  {
92  for (int j = -1; j < 2; j++)
93  {
94  relative_coordinates (0, idx) = i;
95  relative_coordinates (1, idx) = j;
96  relative_coordinates (2, idx) = -1;
97  idx++;
98  }
99  }
100  // 9 - 11
101  for (int i = -1; i < 2; i++)
102  {
103  relative_coordinates (0, idx) = i;
104  relative_coordinates (1, idx) = -1;
105  relative_coordinates (2, idx) = 0;
106  idx++;
107  }
108  // 12
109  relative_coordinates (0, idx) = -1;
110  relative_coordinates (1, idx) = 0;
111  relative_coordinates (2, idx) = 0;
112 
113  return (relative_coordinates);
114  }
115 
116  /** \brief Get the relative cell indices of all the 26 neighbors.
117  * \note Useful in combination with getNeighborCentroidIndices() from \ref VoxelGrid
118  * \ingroup filters
119  */
120  inline Eigen::MatrixXi
122  {
123  Eigen::MatrixXi relative_coordinates = getHalfNeighborCellIndices ();
124  Eigen::MatrixXi relative_coordinates_all( 3, 26);
125  relative_coordinates_all.block<3, 13> (0, 0) = relative_coordinates;
126  relative_coordinates_all.block<3, 13> (0, 13) = -relative_coordinates;
127  return (relative_coordinates_all);
128  }
129 
130  /** \brief Get the minimum and maximum values on each of the 3 (x-y-z) dimensions
131  * in a given pointcloud, without considering points outside of a distance threshold from the laser origin
132  * \param[in] cloud the point cloud data message
133  * \param[in] distance_field_name the field name that contains the distance values
134  * \param[in] min_distance the minimum distance a point will be considered from
135  * \param[in] max_distance the maximum distance a point will be considered to
136  * \param[out] min_pt the resultant minimum bounds
137  * \param[out] max_pt the resultant maximum bounds
138  * \param[in] limit_negative if set to true, then all points outside of the interval (min_distance;max_distace) are considered
139  * \ingroup filters
140  */
141  template <typename PointT> void
142  getMinMax3D (const typename pcl::PointCloud<PointT>::ConstPtr &cloud,
143  const std::string &distance_field_name, float min_distance, float max_distance,
144  Eigen::Vector4f &min_pt, Eigen::Vector4f &max_pt, bool limit_negative = false);
145 
146  /** \brief Get the minimum and maximum values on each of the 3 (x-y-z) dimensions
147  * in a given pointcloud, without considering points outside of a distance threshold from the laser origin
148  * \param[in] cloud the point cloud data message
149  * \param[in] indices the vector of indices to use
150  * \param[in] distance_field_name the field name that contains the distance values
151  * \param[in] min_distance the minimum distance a point will be considered from
152  * \param[in] max_distance the maximum distance a point will be considered to
153  * \param[out] min_pt the resultant minimum bounds
154  * \param[out] max_pt the resultant maximum bounds
155  * \param[in] limit_negative if set to true, then all points outside of the interval (min_distance;max_distace) are considered
156  * \ingroup filters
157  */
158  template <typename PointT> void
159  getMinMax3D (const typename pcl::PointCloud<PointT>::ConstPtr &cloud,
160  const std::vector<int> &indices,
161  const std::string &distance_field_name, float min_distance, float max_distance,
162  Eigen::Vector4f &min_pt, Eigen::Vector4f &max_pt, bool limit_negative = false);
163 
164  /** \brief VoxelGrid assembles a local 3D grid over a given PointCloud, and downsamples + filters the data.
165  *
166  * The VoxelGrid class creates a *3D voxel grid* (think about a voxel
167  * grid as a set of tiny 3D boxes in space) over the input point cloud data.
168  * Then, in each *voxel* (i.e., 3D box), all the points present will be
169  * approximated (i.e., *downsampled*) with their centroid. This approach is
170  * a bit slower than approximating them with the center of the voxel, but it
171  * represents the underlying surface more accurately.
172  *
173  * \author Radu B. Rusu, Bastian Steder
174  * \ingroup filters
175  */
176  template <typename PointT>
177  class VoxelGrid: public Filter<PointT>
178  {
179  protected:
184 
186  typedef typename PointCloud::Ptr PointCloudPtr;
188 
189  public:
190 
191  typedef boost::shared_ptr< VoxelGrid<PointT> > Ptr;
192  typedef boost::shared_ptr< const VoxelGrid<PointT> > ConstPtr;
193 
194  /** \brief Empty constructor. */
196  leaf_size_ (Eigen::Vector4f::Zero ()),
197  inverse_leaf_size_ (Eigen::Array4f::Zero ()),
198  downsample_all_data_ (true),
199  save_leaf_layout_ (false),
200  min_b_ (Eigen::Vector4i::Zero ()),
201  max_b_ (Eigen::Vector4i::Zero ()),
202  div_b_ (Eigen::Vector4i::Zero ()),
203  divb_mul_ (Eigen::Vector4i::Zero ()),
204  filter_field_name_ (""),
205  filter_limit_min_ (-FLT_MAX),
206  filter_limit_max_ (FLT_MAX),
207  filter_limit_negative_ (false),
209  {
210  filter_name_ = "VoxelGrid";
211  }
212 
213  /** \brief Destructor. */
215  {
216  }
217 
218  /** \brief Set the voxel grid leaf size.
219  * \param[in] leaf_size the voxel grid leaf size
220  */
221  inline void
222  setLeafSize (const Eigen::Vector4f &leaf_size)
223  {
224  leaf_size_ = leaf_size;
225  // Avoid division errors
226  if (leaf_size_[3] == 0)
227  leaf_size_[3] = 1;
228  // Use multiplications instead of divisions
229  inverse_leaf_size_ = Eigen::Array4f::Ones () / leaf_size_.array ();
230  }
231 
232  /** \brief Set the voxel grid leaf size.
233  * \param[in] lx the leaf size for X
234  * \param[in] ly the leaf size for Y
235  * \param[in] lz the leaf size for Z
236  */
237  inline void
238  setLeafSize (float lx, float ly, float lz)
239  {
240  leaf_size_[0] = lx; leaf_size_[1] = ly; leaf_size_[2] = lz;
241  // Avoid division errors
242  if (leaf_size_[3] == 0)
243  leaf_size_[3] = 1;
244  // Use multiplications instead of divisions
245  inverse_leaf_size_ = Eigen::Array4f::Ones () / leaf_size_.array ();
246  }
247 
248  /** \brief Get the voxel grid leaf size. */
249  inline Eigen::Vector3f
250  getLeafSize () const { return (leaf_size_.head<3> ()); }
251 
252  /** \brief Set to true if all fields need to be downsampled, or false if just XYZ.
253  * \param[in] downsample the new value (true/false)
254  */
255  inline void
256  setDownsampleAllData (bool downsample) { downsample_all_data_ = downsample; }
257 
258  /** \brief Get the state of the internal downsampling parameter (true if
259  * all fields need to be downsampled, false if just XYZ).
260  */
261  inline bool
263 
264  /** \brief Set the minimum number of points required for a voxel to be used.
265  * \param[in] min_points_per_voxel the minimum number of points for required for a voxel to be used
266  */
267  inline void
268  setMinimumPointsNumberPerVoxel (unsigned int min_points_per_voxel) { min_points_per_voxel_ = min_points_per_voxel; }
269 
270  /** \brief Return the minimum number of points required for a voxel to be used.
271  */
272  inline unsigned int
274 
275  /** \brief Set to true if leaf layout information needs to be saved for later access.
276  * \param[in] save_leaf_layout the new value (true/false)
277  */
278  inline void
279  setSaveLeafLayout (bool save_leaf_layout) { save_leaf_layout_ = save_leaf_layout; }
280 
281  /** \brief Returns true if leaf layout information will to be saved for later access. */
282  inline bool
283  getSaveLeafLayout () const { return (save_leaf_layout_); }
284 
285  /** \brief Get the minimum coordinates of the bounding box (after
286  * filtering is performed).
287  */
288  inline Eigen::Vector3i
289  getMinBoxCoordinates () const { return (min_b_.head<3> ()); }
290 
291  /** \brief Get the minimum coordinates of the bounding box (after
292  * filtering is performed).
293  */
294  inline Eigen::Vector3i
295  getMaxBoxCoordinates () const { return (max_b_.head<3> ()); }
296 
297  /** \brief Get the number of divisions along all 3 axes (after filtering
298  * is performed).
299  */
300  inline Eigen::Vector3i
301  getNrDivisions () const { return (div_b_.head<3> ()); }
302 
303  /** \brief Get the multipliers to be applied to the grid coordinates in
304  * order to find the centroid index (after filtering is performed).
305  */
306  inline Eigen::Vector3i
307  getDivisionMultiplier () const { return (divb_mul_.head<3> ()); }
308 
309  /** \brief Returns the index in the resulting downsampled cloud of the specified point.
310  *
311  * \note for efficiency, user must make sure that the saving of the leaf layout is enabled and filtering
312  * performed, and that the point is inside the grid, to avoid invalid access (or use
313  * getGridCoordinates+getCentroidIndexAt)
314  *
315  * \param[in] p the point to get the index at
316  */
317  inline int
318  getCentroidIndex (const PointT &p) const
319  {
320  return (leaf_layout_.at ((Eigen::Vector4i (static_cast<int> (floor (p.x * inverse_leaf_size_[0])),
321  static_cast<int> (floor (p.y * inverse_leaf_size_[1])),
322  static_cast<int> (floor (p.z * inverse_leaf_size_[2])), 0) - min_b_).dot (divb_mul_)));
323  }
324 
325  /** \brief Returns the indices in the resulting downsampled cloud of the points at the specified grid coordinates,
326  * relative to the grid coordinates of the specified point (or -1 if the cell was empty/out of bounds).
327  * \param[in] reference_point the coordinates of the reference point (corresponding cell is allowed to be empty/out of bounds)
328  * \param[in] relative_coordinates matrix with the columns being the coordinates of the requested cells, relative to the reference point's cell
329  * \note for efficiency, user must make sure that the saving of the leaf layout is enabled and filtering performed
330  */
331  inline std::vector<int>
332  getNeighborCentroidIndices (const PointT &reference_point, const Eigen::MatrixXi &relative_coordinates) const
333  {
334  Eigen::Vector4i ijk (static_cast<int> (floor (reference_point.x * inverse_leaf_size_[0])),
335  static_cast<int> (floor (reference_point.y * inverse_leaf_size_[1])),
336  static_cast<int> (floor (reference_point.z * inverse_leaf_size_[2])), 0);
337  Eigen::Array4i diff2min = min_b_ - ijk;
338  Eigen::Array4i diff2max = max_b_ - ijk;
339  std::vector<int> neighbors (relative_coordinates.cols());
340  for (Eigen::Index ni = 0; ni < relative_coordinates.cols (); ni++)
341  {
342  Eigen::Vector4i displacement = (Eigen::Vector4i() << relative_coordinates.col(ni), 0).finished();
343  // checking if the specified cell is in the grid
344  if ((diff2min <= displacement.array()).all() && (diff2max >= displacement.array()).all())
345  neighbors[ni] = leaf_layout_[((ijk + displacement - min_b_).dot (divb_mul_))]; // .at() can be omitted
346  else
347  neighbors[ni] = -1; // cell is out of bounds, consider it empty
348  }
349  return (neighbors);
350  }
351 
352  /** \brief Returns the layout of the leafs for fast access to cells relative to current position.
353  * \note position at (i-min_x) + (j-min_y)*div_x + (k-min_z)*div_x*div_y holds the index of the element at coordinates (i,j,k) in the grid (-1 if empty)
354  */
355  inline std::vector<int>
356  getLeafLayout () const { return (leaf_layout_); }
357 
358  /** \brief Returns the corresponding (i,j,k) coordinates in the grid of point (x,y,z).
359  * \param[in] x the X point coordinate to get the (i, j, k) index at
360  * \param[in] y the Y point coordinate to get the (i, j, k) index at
361  * \param[in] z the Z point coordinate to get the (i, j, k) index at
362  */
363  inline Eigen::Vector3i
364  getGridCoordinates (float x, float y, float z) const
365  {
366  return (Eigen::Vector3i (static_cast<int> (floor (x * inverse_leaf_size_[0])),
367  static_cast<int> (floor (y * inverse_leaf_size_[1])),
368  static_cast<int> (floor (z * inverse_leaf_size_[2]))));
369  }
370 
371  /** \brief Returns the index in the downsampled cloud corresponding to a given set of coordinates.
372  * \param[in] ijk the coordinates (i,j,k) in the grid (-1 if empty)
373  */
374  inline int
375  getCentroidIndexAt (const Eigen::Vector3i &ijk) const
376  {
377  int idx = ((Eigen::Vector4i() << ijk, 0).finished() - min_b_).dot (divb_mul_);
378  if (idx < 0 || idx >= static_cast<int> (leaf_layout_.size ())) // this checks also if leaf_layout_.size () == 0 i.e. everything was computed as needed
379  {
380  //if (verbose)
381  // PCL_ERROR ("[pcl::%s::getCentroidIndexAt] Specified coordinate is outside grid bounds, or leaf layout is not saved, make sure to call setSaveLeafLayout(true) and filter(output) first!\n", getClassName ().c_str ());
382  return (-1);
383  }
384  return (leaf_layout_[idx]);
385  }
386 
387  /** \brief Provide the name of the field to be used for filtering data. In conjunction with \a setFilterLimits,
388  * points having values outside this interval will be discarded.
389  * \param[in] field_name the name of the field that contains values used for filtering
390  */
391  inline void
392  setFilterFieldName (const std::string &field_name)
393  {
394  filter_field_name_ = field_name;
395  }
396 
397  /** \brief Get the name of the field used for filtering. */
398  inline std::string const
400  {
401  return (filter_field_name_);
402  }
403 
404  /** \brief Set the field filter limits. All points having field values outside this interval will be discarded.
405  * \param[in] limit_min the minimum allowed field value
406  * \param[in] limit_max the maximum allowed field value
407  */
408  inline void
409  setFilterLimits (const double &limit_min, const double &limit_max)
410  {
411  filter_limit_min_ = limit_min;
412  filter_limit_max_ = limit_max;
413  }
414 
415  /** \brief Get the field filter limits (min/max) set by the user. The default values are -FLT_MAX, FLT_MAX.
416  * \param[out] limit_min the minimum allowed field value
417  * \param[out] limit_max the maximum allowed field value
418  */
419  inline void
420  getFilterLimits (double &limit_min, double &limit_max) const
421  {
422  limit_min = filter_limit_min_;
423  limit_max = filter_limit_max_;
424  }
425 
426  /** \brief Set to true if we want to return the data outside the interval specified by setFilterLimits (min, max).
427  * Default: false.
428  * \param[in] limit_negative return data inside the interval (false) or outside (true)
429  */
430  inline void
431  setFilterLimitsNegative (const bool limit_negative)
432  {
433  filter_limit_negative_ = limit_negative;
434  }
435 
436  /** \brief Get whether the data outside the interval (min/max) is to be returned (true) or inside (false).
437  * \param[out] limit_negative true if data \b outside the interval [min; max] is to be returned, false otherwise
438  */
439  inline void
440  getFilterLimitsNegative (bool &limit_negative) const
441  {
442  limit_negative = filter_limit_negative_;
443  }
444 
445  /** \brief Get whether the data outside the interval (min/max) is to be returned (true) or inside (false).
446  * \return true if data \b outside the interval [min; max] is to be returned, false otherwise
447  */
448  inline bool
450  {
451  return (filter_limit_negative_);
452  }
453 
454  protected:
455  /** \brief The size of a leaf. */
456  Eigen::Vector4f leaf_size_;
457 
458  /** \brief Internal leaf sizes stored as 1/leaf_size_ for efficiency reasons. */
459  Eigen::Array4f inverse_leaf_size_;
460 
461  /** \brief Set to true if all fields need to be downsampled, or false if just XYZ. */
463 
464  /** \brief Set to true if leaf layout information needs to be saved in \a leaf_layout_. */
466 
467  /** \brief The leaf layout information for fast access to cells relative to current position **/
468  std::vector<int> leaf_layout_;
469 
470  /** \brief The minimum and maximum bin coordinates, the number of divisions, and the division multiplier. */
471  Eigen::Vector4i min_b_, max_b_, div_b_, divb_mul_;
472 
473  /** \brief The desired user filter field name. */
474  std::string filter_field_name_;
475 
476  /** \brief The minimum allowed filter value a point will be considered from. */
478 
479  /** \brief The maximum allowed filter value a point will be considered from. */
481 
482  /** \brief Set to true if we want to return the data outside (\a filter_limit_min_;\a filter_limit_max_). Default: false. */
484 
485  /** \brief Minimum number of points per voxel for the centroid to be computed */
486  unsigned int min_points_per_voxel_;
487 
489 
490  /** \brief Downsample a Point Cloud using a voxelized grid approach
491  * \param[out] output the resultant point cloud message
492  */
493  void
494  applyFilter (PointCloud &output) override;
495  };
496 
497  /** \brief VoxelGrid assembles a local 3D grid over a given PointCloud, and downsamples + filters the data.
498  *
499  * The VoxelGrid class creates a *3D voxel grid* (think about a voxel
500  * grid as a set of tiny 3D boxes in space) over the input point cloud data.
501  * Then, in each *voxel* (i.e., 3D box), all the points present will be
502  * approximated (i.e., *downsampled*) with their centroid. This approach is
503  * a bit slower than approximating them with the center of the voxel, but it
504  * represents the underlying surface more accurately.
505  *
506  * \author Radu B. Rusu, Bastian Steder, Radoslaw Cybulski
507  * \ingroup filters
508  */
509  template <>
510  class PCL_EXPORTS VoxelGrid<pcl::PCLPointCloud2> : public Filter<pcl::PCLPointCloud2>
511  {
514 
518 
519  public:
520  /** \brief Empty constructor. */
522  leaf_size_ (Eigen::Vector4f::Zero ()),
523  inverse_leaf_size_ (Eigen::Array4f::Zero ()),
524  downsample_all_data_ (true),
525  save_leaf_layout_ (false),
526  min_b_ (Eigen::Vector4i::Zero ()),
527  max_b_ (Eigen::Vector4i::Zero ()),
528  div_b_ (Eigen::Vector4i::Zero ()),
529  divb_mul_ (Eigen::Vector4i::Zero ()),
530  filter_field_name_ (""),
531  filter_limit_min_ (-FLT_MAX),
532  filter_limit_max_ (FLT_MAX),
533  filter_limit_negative_ (false),
535  {
536  filter_name_ = "VoxelGrid";
537  }
538 
539  /** \brief Destructor. */
541  {
542  }
543 
544  /** \brief Set the voxel grid leaf size.
545  * \param[in] leaf_size the voxel grid leaf size
546  */
547  inline void
548  setLeafSize (const Eigen::Vector4f &leaf_size)
549  {
550  leaf_size_ = leaf_size;
551  // Avoid division errors
552  if (leaf_size_[3] == 0)
553  leaf_size_[3] = 1;
554  // Use multiplications instead of divisions
555  inverse_leaf_size_ = Eigen::Array4f::Ones () / leaf_size_.array ();
556  }
557 
558  /** \brief Set the voxel grid leaf size.
559  * \param[in] lx the leaf size for X
560  * \param[in] ly the leaf size for Y
561  * \param[in] lz the leaf size for Z
562  */
563  inline void
564  setLeafSize (float lx, float ly, float lz)
565  {
566  leaf_size_[0] = lx; leaf_size_[1] = ly; leaf_size_[2] = lz;
567  // Avoid division errors
568  if (leaf_size_[3] == 0)
569  leaf_size_[3] = 1;
570  // Use multiplications instead of divisions
571  inverse_leaf_size_ = Eigen::Array4f::Ones () / leaf_size_.array ();
572  }
573 
574  /** \brief Get the voxel grid leaf size. */
575  inline Eigen::Vector3f
576  getLeafSize () const { return (leaf_size_.head<3> ()); }
577 
578  /** \brief Set to true if all fields need to be downsampled, or false if just XYZ.
579  * \param[in] downsample the new value (true/false)
580  */
581  inline void
582  setDownsampleAllData (bool downsample) { downsample_all_data_ = downsample; }
583 
584  /** \brief Get the state of the internal downsampling parameter (true if
585  * all fields need to be downsampled, false if just XYZ).
586  */
587  inline bool
589 
590  /** \brief Set the minimum number of points required for a voxel to be used.
591  * \param[in] min_points_per_voxel the minimum number of points for required for a voxel to be used
592  */
593  inline void
594  setMinimumPointsNumberPerVoxel (unsigned int min_points_per_voxel) { min_points_per_voxel_ = min_points_per_voxel; }
595 
596  /** \brief Return the minimum number of points required for a voxel to be used.
597  */
598  inline unsigned int
600 
601  /** \brief Set to true if leaf layout information needs to be saved for later access.
602  * \param[in] save_leaf_layout the new value (true/false)
603  */
604  inline void
605  setSaveLeafLayout (bool save_leaf_layout) { save_leaf_layout_ = save_leaf_layout; }
606 
607  /** \brief Returns true if leaf layout information will to be saved for later access. */
608  inline bool
609  getSaveLeafLayout () const { return (save_leaf_layout_); }
610 
611  /** \brief Get the minimum coordinates of the bounding box (after
612  * filtering is performed).
613  */
614  inline Eigen::Vector3i
615  getMinBoxCoordinates () const { return (min_b_.head<3> ()); }
616 
617  /** \brief Get the minimum coordinates of the bounding box (after
618  * filtering is performed).
619  */
620  inline Eigen::Vector3i
621  getMaxBoxCoordinates () const { return (max_b_.head<3> ()); }
622 
623  /** \brief Get the number of divisions along all 3 axes (after filtering
624  * is performed).
625  */
626  inline Eigen::Vector3i
627  getNrDivisions () const { return (div_b_.head<3> ()); }
628 
629  /** \brief Get the multipliers to be applied to the grid coordinates in
630  * order to find the centroid index (after filtering is performed).
631  */
632  inline Eigen::Vector3i
633  getDivisionMultiplier () const { return (divb_mul_.head<3> ()); }
634 
635  /** \brief Returns the index in the resulting downsampled cloud of the specified point.
636  * \note for efficiency, user must make sure that the saving of the leaf layout is enabled and filtering performed,
637  * and that the point is inside the grid, to avoid invalid access (or use getGridCoordinates+getCentroidIndexAt)
638  * \param[in] x the X point coordinate to get the index at
639  * \param[in] y the Y point coordinate to get the index at
640  * \param[in] z the Z point coordinate to get the index at
641  */
642  inline int
643  getCentroidIndex (float x, float y, float z) const
644  {
645  return (leaf_layout_.at ((Eigen::Vector4i (static_cast<int> (floor (x * inverse_leaf_size_[0])),
646  static_cast<int> (floor (y * inverse_leaf_size_[1])),
647  static_cast<int> (floor (z * inverse_leaf_size_[2])),
648  0)
649  - min_b_).dot (divb_mul_)));
650  }
651 
652  /** \brief Returns the indices in the resulting downsampled cloud of the points at the specified grid coordinates,
653  * relative to the grid coordinates of the specified point (or -1 if the cell was empty/out of bounds).
654  * \param[in] x the X coordinate of the reference point (corresponding cell is allowed to be empty/out of bounds)
655  * \param[in] y the Y coordinate of the reference point (corresponding cell is allowed to be empty/out of bounds)
656  * \param[in] z the Z coordinate of the reference point (corresponding cell is allowed to be empty/out of bounds)
657  * \param[out] relative_coordinates matrix with the columns being the coordinates of the requested cells, relative to the reference point's cell
658  * \note for efficiency, user must make sure that the saving of the leaf layout is enabled and filtering performed
659  */
660  inline std::vector<int>
661  getNeighborCentroidIndices (float x, float y, float z, const Eigen::MatrixXi &relative_coordinates) const
662  {
663  Eigen::Vector4i ijk (static_cast<int> (floor (x * inverse_leaf_size_[0])),
664  static_cast<int> (floor (y * inverse_leaf_size_[1])),
665  static_cast<int> (floor (z * inverse_leaf_size_[2])), 0);
666  Eigen::Array4i diff2min = min_b_ - ijk;
667  Eigen::Array4i diff2max = max_b_ - ijk;
668  std::vector<int> neighbors (relative_coordinates.cols());
669  for (Eigen::Index ni = 0; ni < relative_coordinates.cols (); ni++)
670  {
671  Eigen::Vector4i displacement = (Eigen::Vector4i() << relative_coordinates.col(ni), 0).finished();
672  // checking if the specified cell is in the grid
673  if ((diff2min <= displacement.array()).all() && (diff2max >= displacement.array()).all())
674  neighbors[ni] = leaf_layout_[((ijk + displacement - min_b_).dot (divb_mul_))]; // .at() can be omitted
675  else
676  neighbors[ni] = -1; // cell is out of bounds, consider it empty
677  }
678  return (neighbors);
679  }
680 
681  /** \brief Returns the indices in the resulting downsampled cloud of the points at the specified grid coordinates,
682  * relative to the grid coordinates of the specified point (or -1 if the cell was empty/out of bounds).
683  * \param[in] x the X coordinate of the reference point (corresponding cell is allowed to be empty/out of bounds)
684  * \param[in] y the Y coordinate of the reference point (corresponding cell is allowed to be empty/out of bounds)
685  * \param[in] z the Z coordinate of the reference point (corresponding cell is allowed to be empty/out of bounds)
686  * \param[out] relative_coordinates vector with the elements being the coordinates of the requested cells, relative to the reference point's cell
687  * \note for efficiency, user must make sure that the saving of the leaf layout is enabled and filtering performed
688  */
689  inline std::vector<int>
690  getNeighborCentroidIndices (float x, float y, float z, const std::vector<Eigen::Vector3i, Eigen::aligned_allocator<Eigen::Vector3i> > &relative_coordinates) const
691  {
692  Eigen::Vector4i ijk (static_cast<int> (floorf (x * inverse_leaf_size_[0])), static_cast<int> (floorf (y * inverse_leaf_size_[1])), static_cast<int> (floorf (z * inverse_leaf_size_[2])), 0);
693  std::vector<int> neighbors;
694  neighbors.reserve (relative_coordinates.size ());
695  for (const auto &relative_coordinate : relative_coordinates)
696  neighbors.push_back (leaf_layout_[(ijk + (Eigen::Vector4i() << relative_coordinate, 0).finished() - min_b_).dot (divb_mul_)]);
697  return (neighbors);
698  }
699 
700  /** \brief Returns the layout of the leafs for fast access to cells relative to current position.
701  * \note position at (i-min_x) + (j-min_y)*div_x + (k-min_z)*div_x*div_y holds the index of the element at coordinates (i,j,k) in the grid (-1 if empty)
702  */
703  inline std::vector<int>
704  getLeafLayout () const { return (leaf_layout_); }
705 
706  /** \brief Returns the corresponding (i,j,k) coordinates in the grid of point (x,y,z).
707  * \param[in] x the X point coordinate to get the (i, j, k) index at
708  * \param[in] y the Y point coordinate to get the (i, j, k) index at
709  * \param[in] z the Z point coordinate to get the (i, j, k) index at
710  */
711  inline Eigen::Vector3i
712  getGridCoordinates (float x, float y, float z) const
713  {
714  return (Eigen::Vector3i (static_cast<int> (floor (x * inverse_leaf_size_[0])),
715  static_cast<int> (floor (y * inverse_leaf_size_[1])),
716  static_cast<int> (floor (z * inverse_leaf_size_[2]))));
717  }
718 
719  /** \brief Returns the index in the downsampled cloud corresponding to a given set of coordinates.
720  * \param[in] ijk the coordinates (i,j,k) in the grid (-1 if empty)
721  */
722  inline int
723  getCentroidIndexAt (const Eigen::Vector3i &ijk) const
724  {
725  int idx = ((Eigen::Vector4i() << ijk, 0).finished() - min_b_).dot (divb_mul_);
726  if (idx < 0 || idx >= static_cast<int> (leaf_layout_.size ())) // this checks also if leaf_layout_.size () == 0 i.e. everything was computed as needed
727  {
728  //if (verbose)
729  // PCL_ERROR ("[pcl::%s::getCentroidIndexAt] Specified coordinate is outside grid bounds, or leaf layout is not saved, make sure to call setSaveLeafLayout(true) and filter(output) first!\n", getClassName ().c_str ());
730  return (-1);
731  }
732  return (leaf_layout_[idx]);
733  }
734 
735  /** \brief Provide the name of the field to be used for filtering data. In conjunction with \a setFilterLimits,
736  * points having values outside this interval will be discarded.
737  * \param[in] field_name the name of the field that contains values used for filtering
738  */
739  inline void
740  setFilterFieldName (const std::string &field_name)
741  {
742  filter_field_name_ = field_name;
743  }
744 
745  /** \brief Get the name of the field used for filtering. */
746  inline std::string const
748  {
749  return (filter_field_name_);
750  }
751 
752  /** \brief Set the field filter limits. All points having field values outside this interval will be discarded.
753  * \param[in] limit_min the minimum allowed field value
754  * \param[in] limit_max the maximum allowed field value
755  */
756  inline void
757  setFilterLimits (const double &limit_min, const double &limit_max)
758  {
759  filter_limit_min_ = limit_min;
760  filter_limit_max_ = limit_max;
761  }
762 
763  /** \brief Get the field filter limits (min/max) set by the user. The default values are -FLT_MAX, FLT_MAX.
764  * \param[out] limit_min the minimum allowed field value
765  * \param[out] limit_max the maximum allowed field value
766  */
767  inline void
768  getFilterLimits (double &limit_min, double &limit_max) const
769  {
770  limit_min = filter_limit_min_;
771  limit_max = filter_limit_max_;
772  }
773 
774  /** \brief Set to true if we want to return the data outside the interval specified by setFilterLimits (min, max).
775  * Default: false.
776  * \param[in] limit_negative return data inside the interval (false) or outside (true)
777  */
778  inline void
779  setFilterLimitsNegative (const bool limit_negative)
780  {
781  filter_limit_negative_ = limit_negative;
782  }
783 
784  /** \brief Get whether the data outside the interval (min/max) is to be returned (true) or inside (false).
785  * \param[out] limit_negative true if data \b outside the interval [min; max] is to be returned, false otherwise
786  */
787  inline void
788  getFilterLimitsNegative (bool &limit_negative) const
789  {
790  limit_negative = filter_limit_negative_;
791  }
792 
793  /** \brief Get whether the data outside the interval (min/max) is to be returned (true) or inside (false).
794  * \return true if data \b outside the interval [min; max] is to be returned, false otherwise
795  */
796  inline bool
798  {
799  return (filter_limit_negative_);
800  }
801 
802  protected:
803  /** \brief The size of a leaf. */
804  Eigen::Vector4f leaf_size_;
805 
806  /** \brief Internal leaf sizes stored as 1/leaf_size_ for efficiency reasons. */
807  Eigen::Array4f inverse_leaf_size_;
808 
809  /** \brief Set to true if all fields need to be downsampled, or false if just XYZ. */
811 
812  /** \brief Set to true if leaf layout information needs to be saved in \a
813  * leaf_layout.
814  */
816 
817  /** \brief The leaf layout information for fast access to cells relative
818  * to current position
819  */
820  std::vector<int> leaf_layout_;
821 
822  /** \brief The minimum and maximum bin coordinates, the number of
823  * divisions, and the division multiplier.
824  */
825  Eigen::Vector4i min_b_, max_b_, div_b_, divb_mul_;
826 
827  /** \brief The desired user filter field name. */
828  std::string filter_field_name_;
829 
830  /** \brief The minimum allowed filter value a point will be considered from. */
832 
833  /** \brief The maximum allowed filter value a point will be considered from. */
835 
836  /** \brief Set to true if we want to return the data outside (\a filter_limit_min_;\a filter_limit_max_). Default: false. */
838 
839  /** \brief Minimum number of points per voxel for the centroid to be computed */
840  unsigned int min_points_per_voxel_;
841 
842  /** \brief Downsample a Point Cloud using a voxelized grid approach
843  * \param[out] output the resultant point cloud
844  */
845  void
846  applyFilter (PCLPointCloud2 &output) override;
847  };
848 }
849 
850 #ifdef PCL_NO_PRECOMPILE
851 #include <pcl/filters/impl/voxel_grid.hpp>
852 #endif
void getFilterLimitsNegative(bool &limit_negative) const
Get whether the data outside the interval (min/max) is to be returned (true) or inside (false)...
Definition: voxel_grid.h:440
PointCloud::Ptr PointCloudPtr
Definition: voxel_grid.h:186
int getCentroidIndexAt(const Eigen::Vector3i &ijk) const
Returns the index in the downsampled cloud corresponding to a given set of coordinates.
Definition: voxel_grid.h:375
unsigned int min_points_per_voxel_
Minimum number of points per voxel for the centroid to be computed.
Definition: voxel_grid.h:486
Eigen::Vector3i getDivisionMultiplier() const
Get the multipliers to be applied to the grid coordinates in order to find the centroid index (after ...
Definition: voxel_grid.h:307
void setLeafSize(const Eigen::Vector4f &leaf_size)
Set the voxel grid leaf size.
Definition: voxel_grid.h:548
void setFilterFieldName(const std::string &field_name)
Provide the name of the field to be used for filtering data.
Definition: voxel_grid.h:392
void setFilterLimitsNegative(const bool limit_negative)
Set to true if we want to return the data outside the interval specified by setFilterLimits (min...
Definition: voxel_grid.h:431
bool downsample_all_data_
Set to true if all fields need to be downsampled, or false if just XYZ.
Definition: voxel_grid.h:810
std::string const getFilterFieldName() const
Get the name of the field used for filtering.
Definition: voxel_grid.h:399
Eigen::Vector3i getNrDivisions() const
Get the number of divisions along all 3 axes (after filtering is performed).
Definition: voxel_grid.h:301
std::vector< int > leaf_layout_
The leaf layout information for fast access to cells relative to current position.
Definition: voxel_grid.h:820
unsigned int min_points_per_voxel_
Minimum number of points per voxel for the centroid to be computed.
Definition: voxel_grid.h:840
bool downsample_all_data_
Set to true if all fields need to be downsampled, or false if just XYZ.
Definition: voxel_grid.h:462
Eigen::Vector3i getGridCoordinates(float x, float y, float z) const
Returns the corresponding (i,j,k) coordinates in the grid of point (x,y,z).
Definition: voxel_grid.h:712
This file defines compatibility wrappers for low level I/O functions.
Definition: convolution.h:44
void setFilterFieldName(const std::string &field_name)
Provide the name of the field to be used for filtering data.
Definition: voxel_grid.h:740
unsigned int getMinimumPointsNumberPerVoxel() const
Return the minimum number of points required for a voxel to be used.
Definition: voxel_grid.h:599
int getCentroidIndexAt(const Eigen::Vector3i &ijk) const
Returns the index in the downsampled cloud corresponding to a given set of coordinates.
Definition: voxel_grid.h:723
void setFilterLimits(const double &limit_min, const double &limit_max)
Set the field filter limits.
Definition: voxel_grid.h:409
Eigen::Vector4i max_b_
Definition: voxel_grid.h:471
int getCentroidIndex(const PointT &p) const
Returns the index in the resulting downsampled cloud of the specified point.
Definition: voxel_grid.h:318
Eigen::Vector4f leaf_size_
The size of a leaf.
Definition: voxel_grid.h:804
Eigen::Vector3i getMinBoxCoordinates() const
Get the minimum coordinates of the bounding box (after filtering is performed).
Definition: voxel_grid.h:615
boost::shared_ptr< VoxelGrid< PointT > > Ptr
Definition: voxel_grid.h:191
bool getDownsampleAllData() const
Get the state of the internal downsampling parameter (true if all fields need to be downsampled...
Definition: voxel_grid.h:262
pcl::traits::fieldList< PointT >::type FieldList
Definition: voxel_grid.h:488
Eigen::Vector4i min_b_
The minimum and maximum bin coordinates, the number of divisions, and the division multiplier...
Definition: voxel_grid.h:825
boost::shared_ptr< ::pcl::PCLPointCloud2 const > PCLPointCloud2ConstPtr
void setDownsampleAllData(bool downsample)
Set to true if all fields need to be downsampled, or false if just XYZ.
Definition: voxel_grid.h:256
std::string const getFilterFieldName() const
Get the name of the field used for filtering.
Definition: voxel_grid.h:747
void getFilterLimits(double &limit_min, double &limit_max) const
Get the field filter limits (min/max) set by the user.
Definition: voxel_grid.h:768
std::vector< int > getNeighborCentroidIndices(float x, float y, float z, const std::vector< Eigen::Vector3i, Eigen::aligned_allocator< Eigen::Vector3i > > &relative_coordinates) const
Returns the indices in the resulting downsampled cloud of the points at the specified grid coordinate...
Definition: voxel_grid.h:690
void setSaveLeafLayout(bool save_leaf_layout)
Set to true if leaf layout information needs to be saved for later access.
Definition: voxel_grid.h:279
VoxelGrid assembles a local 3D grid over a given PointCloud, and downsamples + filters the data...
Definition: voxel_grid.h:177
void setLeafSize(float lx, float ly, float lz)
Set the voxel grid leaf size.
Definition: voxel_grid.h:238
Definition: bfgs.h:9
boost::shared_ptr< ::pcl::PCLPointCloud2 > Ptr
bool getDownsampleAllData() const
Get the state of the internal downsampling parameter (true if all fields need to be downsampled...
Definition: voxel_grid.h:588
Eigen::Vector3i getNrDivisions() const
Get the number of divisions along all 3 axes (after filtering is performed).
Definition: voxel_grid.h:627
std::string filter_field_name_
The desired user filter field name.
Definition: voxel_grid.h:828
bool getFilterLimitsNegative() const
Get whether the data outside the interval (min/max) is to be returned (true) or inside (false)...
Definition: voxel_grid.h:449
bool filter_limit_negative_
Set to true if we want to return the data outside (filter_limit_min_;filter_limit_max_).
Definition: voxel_grid.h:837
boost::shared_ptr< PointCloud< PointT > > Ptr
Definition: point_cloud.h:427
std::vector< int > getNeighborCentroidIndices(float x, float y, float z, const Eigen::MatrixXi &relative_coordinates) const
Returns the indices in the resulting downsampled cloud of the points at the specified grid coordinate...
Definition: voxel_grid.h:661
bool getFilterLimitsNegative() const
Get whether the data outside the interval (min/max) is to be returned (true) or inside (false)...
Definition: voxel_grid.h:797
unsigned int getMinimumPointsNumberPerVoxel() const
Return the minimum number of points required for a voxel to be used.
Definition: voxel_grid.h:273
Eigen::Vector3i getDivisionMultiplier() const
Get the multipliers to be applied to the grid coordinates in order to find the centroid index (after ...
Definition: voxel_grid.h:633
Eigen::Array4f inverse_leaf_size_
Internal leaf sizes stored as 1/leaf_size_ for efficiency reasons.
Definition: voxel_grid.h:807
Eigen::Vector3i getMaxBoxCoordinates() const
Get the minimum coordinates of the bounding box (after filtering is performed).
Definition: voxel_grid.h:621
Eigen::Vector3i getGridCoordinates(float x, float y, float z) const
Returns the corresponding (i,j,k) coordinates in the grid of point (x,y,z).
Definition: voxel_grid.h:364
std::vector< int > getLeafLayout() const
Returns the layout of the leafs for fast access to cells relative to current position.
Definition: voxel_grid.h:356
Filter represents the base filter class.
Definition: filter.h:83
void setLeafSize(float lx, float ly, float lz)
Set the voxel grid leaf size.
Definition: voxel_grid.h:564
Eigen::Vector3i getMaxBoxCoordinates() const
Get the minimum coordinates of the bounding box (after filtering is performed).
Definition: voxel_grid.h:295
void setMinimumPointsNumberPerVoxel(unsigned int min_points_per_voxel)
Set the minimum number of points required for a voxel to be used.
Definition: voxel_grid.h:268
Eigen::Array4f inverse_leaf_size_
Internal leaf sizes stored as 1/leaf_size_ for efficiency reasons.
Definition: voxel_grid.h:459
Eigen::Vector3f getLeafSize() const
Get the voxel grid leaf size.
Definition: voxel_grid.h:250
bool getSaveLeafLayout() const
Returns true if leaf layout information will to be saved for later access.
Definition: voxel_grid.h:609
void getMinMax3D(const pcl::PointCloud< PointT > &cloud, PointT &min_pt, PointT &max_pt)
Get the minimum and maximum values on each of the 3 (x-y-z) dimensions in a given pointcloud...
Definition: common.hpp:242
Eigen::MatrixXi getHalfNeighborCellIndices()
Get the relative cell indices of the "upper half" 13 neighbors.
Definition: voxel_grid.h:84
boost::shared_ptr< const PointCloud< PointT > > ConstPtr
Definition: point_cloud.h:428
void setFilterLimitsNegative(const bool limit_negative)
Set to true if we want to return the data outside the interval specified by setFilterLimits (min...
Definition: voxel_grid.h:779
std::vector< int > getLeafLayout() const
Returns the layout of the leafs for fast access to cells relative to current position.
Definition: voxel_grid.h:704
void setSaveLeafLayout(bool save_leaf_layout)
Set to true if leaf layout information needs to be saved for later access.
Definition: voxel_grid.h:605
void setDownsampleAllData(bool downsample)
Set to true if all fields need to be downsampled, or false if just XYZ.
Definition: voxel_grid.h:582
boost::shared_ptr< ::pcl::PCLPointCloud2 const > ConstPtr
void setFilterLimits(const double &limit_min, const double &limit_max)
Set the field filter limits.
Definition: voxel_grid.h:757
double filter_limit_max_
The maximum allowed filter value a point will be considered from.
Definition: voxel_grid.h:834
Eigen::Vector4i divb_mul_
Definition: voxel_grid.h:471
PointCloud represents the base class in PCL for storing collections of 3D points. ...
~VoxelGrid()
Destructor.
Definition: voxel_grid.h:214
void applyFilter(PointCloud &output) override
Downsample a Point Cloud using a voxelized grid approach.
Definition: voxel_grid.hpp:214
void getFilterLimits(double &limit_min, double &limit_max) const
Get the field filter limits (min/max) set by the user.
Definition: voxel_grid.h:420
Eigen::Vector4f leaf_size_
The size of a leaf.
Definition: voxel_grid.h:456
boost::shared_ptr< ::pcl::PCLPointCloud2 > PCLPointCloud2Ptr
std::vector< int > leaf_layout_
The leaf layout information for fast access to cells relative to current position.
Definition: voxel_grid.h:468
void setMinimumPointsNumberPerVoxel(unsigned int min_points_per_voxel)
Set the minimum number of points required for a voxel to be used.
Definition: voxel_grid.h:594
std::string filter_field_name_
The desired user filter field name.
Definition: voxel_grid.h:474
VoxelGrid()
Empty constructor.
Definition: voxel_grid.h:195
bool filter_limit_negative_
Set to true if we want to return the data outside (filter_limit_min_;filter_limit_max_).
Definition: voxel_grid.h:483
int getCentroidIndex(float x, float y, float z) const
Returns the index in the resulting downsampled cloud of the specified point.
Definition: voxel_grid.h:643
bool save_leaf_layout_
Set to true if leaf layout information needs to be saved in leaf_layout.
Definition: voxel_grid.h:815
boost::shared_ptr< const VoxelGrid< PointT > > ConstPtr
Definition: voxel_grid.h:192
std::vector< int > getNeighborCentroidIndices(const PointT &reference_point, const Eigen::MatrixXi &relative_coordinates) const
Returns the indices in the resulting downsampled cloud of the points at the specified grid coordinate...
Definition: voxel_grid.h:332
Eigen::MatrixXi getAllNeighborCellIndices()
Get the relative cell indices of all the 26 neighbors.
Definition: voxel_grid.h:121
bool getSaveLeafLayout() const
Returns true if leaf layout information will to be saved for later access.
Definition: voxel_grid.h:283
Eigen::Vector3f getLeafSize() const
Get the voxel grid leaf size.
Definition: voxel_grid.h:576
Eigen::Vector3i getMinBoxCoordinates() const
Get the minimum coordinates of the bounding box (after filtering is performed).
Definition: voxel_grid.h:289
double filter_limit_min_
The minimum allowed filter value a point will be considered from.
Definition: voxel_grid.h:831
double filter_limit_max_
The maximum allowed filter value a point will be considered from.
Definition: voxel_grid.h:480
PointCloud::ConstPtr PointCloudConstPtr
Definition: voxel_grid.h:187
std::string filter_name_
The filter name.
Definition: filter.h:164
Eigen::Vector4i min_b_
The minimum and maximum bin coordinates, the number of divisions, and the division multiplier...
Definition: voxel_grid.h:471
A point structure representing Euclidean xyz coordinates, and the RGB color.
bool save_leaf_layout_
Set to true if leaf layout information needs to be saved in leaf_layout_.
Definition: voxel_grid.h:465
double filter_limit_min_
The minimum allowed filter value a point will be considered from.
Definition: voxel_grid.h:477
void getFilterLimitsNegative(bool &limit_negative) const
Get whether the data outside the interval (min/max) is to be returned (true) or inside (false)...
Definition: voxel_grid.h:788
Eigen::Vector4i div_b_
Definition: voxel_grid.h:471
void setLeafSize(const Eigen::Vector4f &leaf_size)
Set the voxel grid leaf size.
Definition: voxel_grid.h:222
Filter< PointT >::PointCloud PointCloud
Definition: voxel_grid.h:185