Point Cloud Library (PCL)  1.15.1-dev
conditional_removal.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2010, Willow Garage, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of the copyright holder(s) nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *
34  * $Id$
35  *
36  */
37 
38 #pragma once
39 
40 #include <pcl/memory.h>
41 #include <pcl/pcl_config.h> // for PCL_NO_PRECOMPILE
42 #include <pcl/filters/filter.h>
43 
44 namespace pcl
45 {
46  //////////////////////////////////////////////////////////////////////////////////////////
47  namespace ComparisonOps
48  {
49  /** \brief The kind of comparison operations that are possible within a
50  * comparison object
51  */
52  enum CompareOp
53  {
54  GT, GE, LT, LE, EQ
55  };
56  }
57 
58  //////////////////////////////////////////////////////////////////////////////////////////
59  /** \brief A datatype that enables type-correct comparisons. */
60  template<typename PointT>
62  {
63  public:
64  /** \brief Constructor. */
65  PointDataAtOffset (std::uint8_t datatype, std::uint32_t offset) :
66  datatype_ (datatype), offset_ (offset)
67  {
68  }
69 
70  /** \brief Compare function.
71  * \param p the point to compare
72  * \param val the value to compare the point to
73  */
74  int
75  compare (const PointT& p, const double& val);
76  protected:
77  /** \brief The type of data. */
78  std::uint8_t datatype_;
79 
80  /** \brief The data offset. */
81  std::uint32_t offset_;
82  private:
83  PointDataAtOffset () : datatype_ (), offset_ () {}
84  };
85 
86  //////////////////////////////////////////////////////////////////////////////////////////
87  /** \brief The (abstract) base class for the comparison object. */
88  template<typename PointT>
90  {
91  public:
92  using Ptr = shared_ptr<ComparisonBase<PointT> >;
93  using ConstPtr = shared_ptr<const ComparisonBase<PointT> >;
94 
95  /** \brief Constructor. */
96  ComparisonBase () = default;
97 
98  /** \brief Destructor. */
99  virtual ~ComparisonBase () = default;
100 
101  /** \brief Return if the comparison is capable. */
102  inline bool
103  isCapable () const
104  {
105  return (capable_);
106  }
107 
108  /** \brief Evaluate function. */
109  virtual bool
110  evaluate (const PointT &point) const = 0;
111 
112  protected:
113  /** \brief True if capable. */
114  bool capable_{false};
115 
116  /** \brief Field name to compare data on. */
117  std::string field_name_;
118 
119  /** \brief The data offset. */
120  std::uint32_t offset_{0};
121 
122  /** \brief The comparison operator type. */
124  };
125 
126  //////////////////////////////////////////////////////////////////////////////////////////
127  /** \brief The field-based specialization of the comparison object. */
128  template<typename PointT>
129  class FieldComparison : public ComparisonBase<PointT>
130  {
134 
135  public:
136  using Ptr = shared_ptr<FieldComparison<PointT> >;
137  using ConstPtr = shared_ptr<const FieldComparison<PointT> >;
138 
139 
140  /** \brief Construct a FieldComparison
141  * \param field_name the name of the field that contains the data we want to compare
142  * \param op the operator to use when making the comparison
143  * \param compare_val the constant value to compare the field value too
144  */
145  FieldComparison (const std::string &field_name, ComparisonOps::CompareOp op, double compare_val);
146 
147  /** \brief Copy constructor.
148  * \param[in] src the field comparison object to copy into this
149  */
151  : ComparisonBase<PointT> ()
153  {
154  }
155 
156  /** \brief Copy operator.
157  * \param[in] src the field comparison object to copy into this
158  */
159  inline FieldComparison&
161  {
162  if (this == &src)
163  return *this;
165  point_data_ = src.point_data_;
166  return *this;
167  }
168 
169  /** \brief Destructor. */
170  ~FieldComparison () override;
171 
172  /** \brief Determine the result of this comparison.
173  * \param point the point to evaluate
174  * \return the result of this comparison.
175  */
176  bool
177  evaluate (const PointT &point) const override;
178 
179  protected:
180  /** \brief All types (that we care about) can be represented as a double. */
181  double compare_val_;
182 
183  /** \brief The point data to compare. */
185 
186  private:
187  FieldComparison () :
189  {
190  } // not allowed
191  };
192 
193  //////////////////////////////////////////////////////////////////////////////////////////
194  /** \brief A packed rgb specialization of the comparison object. */
195  template<typename PointT>
196  class PackedRGBComparison : public ComparisonBase<PointT>
197  {
200 
201  public:
202  using Ptr = shared_ptr<PackedRGBComparison<PointT> >;
203  using ConstPtr = shared_ptr<const PackedRGBComparison<PointT> >;
204 
205  /** \brief Construct a PackedRGBComparison
206  * \param component_name either "r", "g" or "b"
207  * \param op the operator to use when making the comparison
208  * \param compare_val the constant value to compare the component value too
209  */
210  PackedRGBComparison (const std::string &component_name, ComparisonOps::CompareOp op, double compare_val);
211 
212  /** \brief Destructor. */
213  ~PackedRGBComparison () override = default;
214 
215  /** \brief Determine the result of this comparison.
216  * \param point the point to evaluate
217  * \return the result of this comparison.
218  */
219  bool
220  evaluate (const PointT &point) const override;
221 
222  protected:
223  /** \brief The name of the component. */
224  std::string component_name_;
225 
226  /** \brief The offset of the component */
227  std::uint32_t component_offset_;
228 
229  /** \brief All types (that we care about) can be represented as a double. */
230  double compare_val_;
231 
232  private:
235  {
236  } // not allowed
237 
238  };
239 
240  //////////////////////////////////////////////////////////////////////////////////////////
241  /** \brief A packed HSI specialization of the comparison object. */
242  template<typename PointT>
243  class PackedHSIComparison : public ComparisonBase<PointT>
244  {
247 
248  public:
249  using Ptr = shared_ptr<PackedHSIComparison<PointT> >;
250  using ConstPtr = shared_ptr<const PackedHSIComparison<PointT> >;
251 
252  /** \brief Construct a PackedHSIComparison
253  * \param component_name either "h", "s" or "i"
254  * \param op the operator to use when making the comparison
255  * \param compare_val the constant value to compare the component value too
256  */
257  PackedHSIComparison (const std::string &component_name, ComparisonOps::CompareOp op, double compare_val);
258 
259  /** \brief Destructor. */
260  ~PackedHSIComparison () override = default;
261 
262  /** \brief Determine the result of this comparison.
263  * \param point the point to evaluate
264  * \return the result of this comparison.
265  */
266  bool
267  evaluate (const PointT &point) const override;
268 
270  {
271  H, // -128 to 127 corresponds to -pi to pi
272  S, // 0 to 255
273  I // 0 to 255
274  };
275 
276  protected:
277  /** \brief The name of the component. */
278  std::string component_name_;
279 
280  /** \brief The ID of the component. */
282 
283  /** \brief All types (that we care about) can be represented as a double. */
284  double compare_val_;
285 
286  /** \brief The offset of the component */
287  std::uint32_t rgb_offset_;
288 
289  private:
292  {
293  } // not allowed
294  };
295 
296  //////////////////////////////////////////////////////////////////////////////////////////
297  /**\brief A comparison whether the (x,y,z) components of a given point satisfy (p'Ap + 2v'p + c [OP] 0).
298  * Here [OP] stands for the defined pcl::ComparisonOps, i.e. for GT, GE, LT, LE or EQ;
299  * p = (x,y,z) is a point of the point cloud; A is 3x3 matrix; v is the 3x1 vector; c is a scalar.
300  *
301  * One can also use TfQuadraticXYZComparison for simpler geometric shapes by defining the
302  * quadratic parts (i.e. the matrix A) to be zero. By combining different instances of
303  * TfQuadraticXYZComparison one can get more complex shapes. For example, to have a simple
304  * cylinder (along the x-axis) of specific radius and length, three comparisons need to be
305  * combined as AND condition:
306  * 1. side: A = [0 0 0, 0 1 0, 0 0 1]; v = [0, 0, 0]; c = -radius²; OP = LT (meaning "<")
307  * 2. bottom base: A = 0; v = [0.5, 0, 0]; c = -x_min; OP = GT
308  * 3. top base: A = 0; v = [0.5, 0, 0]; c = -x_max; OP = LT
309  *
310  * \author Julian Löchner
311  */
312  template<typename PointT>
314  {
315  public:
316  PCL_MAKE_ALIGNED_OPERATOR_NEW // needed whenever there is a fixed size Eigen:: vector or matrix in a class
317 
318  using Ptr = shared_ptr<TfQuadraticXYZComparison<PointT> >;
319  using ConstPtr = shared_ptr<const TfQuadraticXYZComparison<PointT> >;
320 
321  /** \brief Constructor.
322  */
324 
325  /** \brief Empty destructor */
326  ~TfQuadraticXYZComparison () override = default;
327 
328  /** \brief Constructor.
329  * \param op the operator "[OP]" of the comparison "p'Ap + 2v'p + c [OP] 0".
330  * \param comparison_matrix the matrix "A" of the comparison "p'Ap + 2v'p + c [OP] 0".
331  * \param comparison_vector the vector "v" of the comparison "p'Ap + 2v'p + c [OP] 0".
332  * \param comparison_scalar the scalar "c" of the comparison "p'Ap + 2v'p + c [OP] 0".
333  * \param comparison_transform the transformation of the comparison.
334  */
335  TfQuadraticXYZComparison (const pcl::ComparisonOps::CompareOp op, const Eigen::Matrix3f &comparison_matrix,
336  const Eigen::Vector3f &comparison_vector, const float &comparison_scalar,
337  const Eigen::Affine3f &comparison_transform = Eigen::Affine3f::Identity ());
338 
339  /** \brief set the operator "[OP]" of the comparison "p'Ap + 2v'p + c [OP] 0".
340  */
341  inline void
343  {
344  op_ = op;
345  }
346 
347  /** \brief set the matrix "A" of the comparison "p'Ap + 2v'p + c [OP] 0".
348  */
349  inline void
350  setComparisonMatrix (const Eigen::Matrix3f &matrix)
351  {
352  //define comp_matr_ as an homogeneous matrix of the given matrix
353  comp_matr_.block<3, 3> (0, 0) = matrix;
354  comp_matr_.col (3) << 0, 0, 0, 1;
355  comp_matr_.block<1, 3> (3, 0) << 0, 0, 0;
356  tf_comp_matr_ = comp_matr_;
357  }
358 
359  /** \brief set the matrix "A" of the comparison "p'Ap + 2v'p + c [OP] 0".
360  */
361  inline void
362  setComparisonMatrix (const Eigen::Matrix4f &homogeneousMatrix)
363  {
364  comp_matr_ = homogeneousMatrix;
365  tf_comp_matr_ = comp_matr_;
366  }
367 
368  /** \brief set the vector "v" of the comparison "p'Ap + 2v'p + c [OP] 0".
369  */
370  inline void
371  setComparisonVector (const Eigen::Vector3f &vector)
372  {
373  comp_vect_ = vector.homogeneous ();
374  tf_comp_vect_ = comp_vect_;
375  }
376 
377  /** \brief set the vector "v" of the comparison "p'Ap + 2v'p + c [OP] 0".
378  */
379  inline void
380  setComparisonVector (const Eigen::Vector4f &homogeneousVector)
381  {
382  comp_vect_ = homogeneousVector;
383  tf_comp_vect_ = comp_vect_;
384  }
385 
386  /** \brief set the scalar "c" of the comparison "p'Ap + 2v'p + c [OP] 0".
387  */
388  inline void
389  setComparisonScalar (const float &scalar)
390  {
391  comp_scalar_ = scalar;
392  }
393 
394  /** \brief transform the coordinate system of the comparison. If you think of
395  * the transformation to be a translation and rotation of the comparison in the
396  * same coordinate system, you have to provide the inverse transformation.
397  * This function does not change the original definition of the comparison. Thus,
398  * each call of this function will assume the original definition of the comparison
399  * as starting point for the transformation.
400  *
401  * @param transform the transformation (rotation and translation) as an affine matrix.
402  */
403  inline void
404  transformComparison (const Eigen::Matrix4f &transform)
405  {
406  tf_comp_matr_.noalias() = transform.transpose () * comp_matr_ * transform;
407  tf_comp_vect_.noalias() = comp_vect_.transpose () * transform;
408  }
409 
410  /** \brief transform the coordinate system of the comparison. If you think of
411  * the transformation to be a translation and rotation of the comparison in the
412  * same coordinate system, you have to provide the inverse transformation.
413  * This function does not change the original definition of the comparison. Thus,
414  * each call of this function will assume the original definition of the comparison
415  * as starting point for the transformation.
416  *
417  * @param transform the transformation (rotation and translation) as an affine matrix.
418  */
419  inline void
420  transformComparison (const Eigen::Affine3f &transform)
421  {
422  transformComparison (transform.matrix ());
423  }
424 
425  /** \brief Determine the result of this comparison.
426  * \param point the point to evaluate
427  * \return the result of this comparison.
428  */
429  bool
430  evaluate (const PointT &point) const override;
431 
432  protected:
435 
436  Eigen::Matrix4f comp_matr_;
437  Eigen::Vector4f comp_vect_;
438 
440 
441  private:
442  Eigen::Matrix4f tf_comp_matr_;
443  Eigen::Vector4f tf_comp_vect_;
444  };
445 
446  //////////////////////////////////////////////////////////////////////////////////////////
447  /** \brief Base condition class. */
448  template<typename PointT>
450  {
451  public:
455 
456  using Ptr = shared_ptr<ConditionBase<PointT> >;
457  using ConstPtr = shared_ptr<const ConditionBase<PointT> >;
458 
459  /** \brief Constructor. */
461  {
462  }
463 
464  /** \brief Destructor. */
465  virtual ~ConditionBase () = default;
466 
467  /** \brief Add a new comparison
468  * \param comparison the comparison operator to add
469  */
470  void
472 
473  /** \brief Add a nested condition to this condition.
474  * \param condition the nested condition to be added
475  */
476  void
477  addCondition (Ptr condition);
478 
479  /** \brief Check if evaluation requirements are met. */
480  inline bool
481  isCapable () const
482  {
483  return (capable_);
484  }
485 
486  /** \brief Determine if a point meets this condition.
487  * \return whether the point meets this condition.
488  */
489  virtual bool
490  evaluate (const PointT &point) const = 0;
491 
492  protected:
493  /** \brief True if capable. */
494  bool capable_{true};
495 
496  /** \brief The collection of all comparisons that need to be verified. */
497  std::vector<ComparisonBaseConstPtr> comparisons_;
498 
499  /** \brief The collection of all conditions that need to be verified. */
500  std::vector<Ptr> conditions_;
501  };
502 
503  //////////////////////////////////////////////////////////////////////////////////////////
504  /** \brief AND condition. */
505  template<typename PointT>
506  class ConditionAnd : public ConditionBase<PointT>
507  {
510 
511  public:
512  using Ptr = shared_ptr<ConditionAnd<PointT> >;
513  using ConstPtr = shared_ptr<const ConditionAnd<PointT> >;
514 
515  /** \brief Constructor. */
518  {
519  }
520 
521  /** \brief Determine if a point meets this condition.
522  * \return whether the point meets this condition.
523  *
524  * The ConditionAnd evaluates to true when ALL
525  * comparisons and nested conditions evaluate to true
526  */
527  bool
528  evaluate (const PointT &point) const override;
529  };
530 
531  //////////////////////////////////////////////////////////////////////////////////////////
532  /** \brief OR condition. */
533  template<typename PointT>
534  class ConditionOr : public ConditionBase<PointT>
535  {
538 
539  public:
540  using Ptr = shared_ptr<ConditionOr<PointT> >;
541  using ConstPtr = shared_ptr<const ConditionOr<PointT> >;
542 
543  /** \brief Constructor. */
546  {
547  }
548 
549  /** \brief Determine if a point meets this condition.
550  * \return whether the point meets this condition.
551  *
552  * The ConditionOr evaluates to true when ANY
553  * comparisons or nested conditions evaluate to true
554  */
555  bool
556  evaluate (const PointT &point) const override;
557  };
558 
559  //////////////////////////////////////////////////////////////////////////////////////////
560  /** \brief @b ConditionalRemoval filters data that satisfies certain conditions.
561  *
562  * A ConditionalRemoval must be provided a condition. There are two types of
563  * conditions: ConditionAnd and ConditionOr. Conditions require one or more
564  * comparisons and/or other conditions. A comparison has a name, a
565  * comparison operator, and a value.
566  *
567  * An ConditionAnd will evaluate to true when ALL of its encapsulated
568  * comparisons and conditions are true.
569  *
570  * An ConditionOr will evaluate to true when ANY of its encapsulated
571  * comparisons and conditions are true.
572  *
573  * Depending on the derived type of the comparison, the name can correspond
574  * to a PointCloud field name, or a color component in rgb color space or
575  * hsi color space.
576  *
577  * Here is an example usage:
578  * \code
579  * // Build the condition
580  * pcl::ConditionAnd<PointT>::Ptr range_cond (new pcl::ConditionAnd<PointT> ());
581  * range_cond->addComparison (pcl::FieldComparison<PointT>::Ptr (new pcl::FieldComparison<PointT>("z", pcl::ComparisonOps::LT, 2.0)));
582  * range_cond->addComparison (pcl::FieldComparison<PointT>::Ptr (new pcl::FieldComparison<PointT>("z", pcl::ComparisonOps::GT, 0.0)));
583  * // Build the filter
584  * pcl::ConditionalRemoval<PointT> range_filt;
585  * range_filt.setCondition (range_cond);
586  * range_filt.setKeepOrganized (false);
587  * \endcode
588  *
589  * \author Louis LeGrand, Intel Labs Seattle
590  * \ingroup filters
591  */
592  template<typename PointT>
593  class ConditionalRemoval : public Filter<PointT>
594  {
598 
601 
602  using PointCloud = typename Filter<PointT>::PointCloud;
603  using PointCloudPtr = typename PointCloud::Ptr;
604  using PointCloudConstPtr = typename PointCloud::ConstPtr;
605 
606  public:
610 
611  using Ptr = shared_ptr<ConditionalRemoval<PointT> >;
612  using ConstPtr = shared_ptr<const ConditionalRemoval<PointT> >;
613 
614 
615  /** \brief the default constructor.
616  *
617  * All ConditionalRemovals require a condition which can be set
618  * using the setCondition method
619  * \param extract_removed_indices extract filtered indices from indices vector
620  */
621  ConditionalRemoval (int extract_removed_indices = false) :
622  Filter<PointT>::Filter (extract_removed_indices), condition_ (),
623  user_filter_value_ (std::numeric_limits<float>::quiet_NaN ())
624  {
625  filter_name_ = "ConditionalRemoval";
626  }
627 
628  /** \brief Set whether the filtered points should be kept and set to the
629  * value given through \a setUserFilterValue (default: NaN), or removed
630  * from the PointCloud, thus potentially breaking its organized
631  * structure. By default, points are removed.
632  *
633  * \param val set to true whether the filtered points should be kept and
634  * set to a given user value (default: NaN)
635  */
636  inline void
637  setKeepOrganized (bool val)
638  {
639  keep_organized_ = val;
640  }
641 
642  inline bool
644  {
645  return (keep_organized_);
646  }
647 
648  /** \brief Provide a value that the filtered points should be set to
649  * instead of removing them. Used in conjunction with \a
650  * setKeepOrganized ().
651  * \param val the user given value that the filtered point dimensions should be set to
652  */
653  inline void
654  setUserFilterValue (float val)
655  {
656  user_filter_value_ = val;
657  }
658 
659  /** \brief Set the condition that the filter will use.
660  * \param condition each point must satisfy this condition to avoid
661  * being removed by the filter
662  *
663  * All ConditionalRemovals require a condition
664  */
665  void
666  setCondition (ConditionBasePtr condition);
667 
668  protected:
669  /** \brief Filter a Point Cloud.
670  * \param output the resultant point cloud message
671  */
672  void
673  applyFilter (PointCloud &output) override;
674 
675  /** \brief True if capable. */
676  bool capable_{false};
677 
678  /** \brief Keep the structure of the data organized, by setting the
679  * filtered points to the a user given value (NaN by default).
680  */
681  bool keep_organized_{false};
682 
683  /** \brief The condition to use for filtering */
685 
686  /** \brief User given value to be set to any filtered point. Casted to
687  * the correct field type.
688  */
690  };
691 }
692 
693 #ifdef PCL_NO_PRECOMPILE
694 #include <pcl/filters/impl/conditional_removal.hpp>
695 #endif
The (abstract) base class for the comparison object.
shared_ptr< ComparisonBase< PointT > > Ptr
shared_ptr< const ComparisonBase< PointT > > ConstPtr
virtual bool evaluate(const PointT &point) const =0
Evaluate function.
ComparisonBase()=default
Constructor.
std::uint32_t offset_
The data offset.
ComparisonOps::CompareOp op_
The comparison operator type.
bool capable_
True if capable.
virtual ~ComparisonBase()=default
Destructor.
bool isCapable() const
Return if the comparison is capable.
std::string field_name_
Field name to compare data on.
bool evaluate(const PointT &point) const override
Determine if a point meets this condition.
ConditionAnd()
Constructor.
Base condition class.
bool isCapable() const
Check if evaluation requirements are met.
bool capable_
True if capable.
void addCondition(Ptr condition)
Add a nested condition to this condition.
typename ComparisonBase::Ptr ComparisonBasePtr
typename ComparisonBase::ConstPtr ComparisonBaseConstPtr
std::vector< ComparisonBaseConstPtr > comparisons_
The collection of all comparisons that need to be verified.
shared_ptr< const ConditionBase< PointT > > ConstPtr
std::vector< Ptr > conditions_
The collection of all conditions that need to be verified.
virtual bool evaluate(const PointT &point) const =0
Determine if a point meets this condition.
ConditionBase()
Constructor.
virtual ~ConditionBase()=default
Destructor.
void addComparison(ComparisonBaseConstPtr comparison)
Add a new comparison.
shared_ptr< ConditionBase< PointT > > Ptr
ConditionOr()
Constructor.
bool evaluate(const PointT &point) const override
Determine if a point meets this condition.
ConditionalRemoval filters data that satisfies certain conditions.
typename ConditionBase::ConstPtr ConditionBaseConstPtr
shared_ptr< const ConditionalRemoval< PointT > > ConstPtr
void applyFilter(PointCloud &output) override
Filter a Point Cloud.
ConditionalRemoval(int extract_removed_indices=false)
the default constructor.
void setCondition(ConditionBasePtr condition)
Set the condition that the filter will use.
bool keep_organized_
Keep the structure of the data organized, by setting the filtered points to the a user given value (N...
void setUserFilterValue(float val)
Provide a value that the filtered points should be set to instead of removing them.
shared_ptr< ConditionalRemoval< PointT > > Ptr
ConditionBasePtr condition_
The condition to use for filtering.
typename ConditionBase::Ptr ConditionBasePtr
bool capable_
True if capable.
void setKeepOrganized(bool val)
Set whether the filtered points should be kept and set to the value given through setUserFilterValue ...
float user_filter_value_
User given value to be set to any filtered point.
The field-based specialization of the comparison object.
~FieldComparison() override
Destructor.
double compare_val_
All types (that we care about) can be represented as a double.
FieldComparison & operator=(const FieldComparison &src)
Copy operator.
PointDataAtOffset< PointT > * point_data_
The point data to compare.
FieldComparison(const FieldComparison &src)
Copy constructor.
bool evaluate(const PointT &point) const override
Determine the result of this comparison.
Filter represents the base filter class.
Definition: filter.h:81
std::string filter_name_
The filter name.
Definition: filter.h:158
typename PointCloud::Ptr PointCloudPtr
Definition: pcl_base.h:73
typename PointCloud::ConstPtr PointCloudConstPtr
Definition: pcl_base.h:74
A packed HSI specialization of the comparison object.
~PackedHSIComparison() override=default
Destructor.
std::uint32_t rgb_offset_
The offset of the component.
bool evaluate(const PointT &point) const override
Determine the result of this comparison.
std::string component_name_
The name of the component.
ComponentId component_id_
The ID of the component.
double compare_val_
All types (that we care about) can be represented as a double.
A packed rgb specialization of the comparison object.
bool evaluate(const PointT &point) const override
Determine the result of this comparison.
std::uint32_t component_offset_
The offset of the component.
double compare_val_
All types (that we care about) can be represented as a double.
~PackedRGBComparison() override=default
Destructor.
std::string component_name_
The name of the component.
PointCloud represents the base class in PCL for storing collections of 3D points.
Definition: point_cloud.h:174
shared_ptr< PointCloud< PointT > > Ptr
Definition: point_cloud.h:414
shared_ptr< const PointCloud< PointT > > ConstPtr
Definition: point_cloud.h:415
A datatype that enables type-correct comparisons.
int compare(const PointT &p, const double &val)
Compare function.
PointDataAtOffset(std::uint8_t datatype, std::uint32_t offset)
Constructor.
std::uint8_t datatype_
The type of data.
std::uint32_t offset_
The data offset.
A comparison whether the (x,y,z) components of a given point satisfy (p'Ap + 2v'p + c [OP] 0).
void setComparisonVector(const Eigen::Vector3f &vector)
set the vector "v" of the comparison "p'Ap + 2v'p + c [OP] 0".
void setComparisonVector(const Eigen::Vector4f &homogeneousVector)
set the vector "v" of the comparison "p'Ap + 2v'p + c [OP] 0".
void setComparisonScalar(const float &scalar)
set the scalar "c" of the comparison "p'Ap + 2v'p + c [OP] 0".
~TfQuadraticXYZComparison() override=default
Empty destructor.
void transformComparison(const Eigen::Matrix4f &transform)
transform the coordinate system of the comparison.
void setComparisonMatrix(const Eigen::Matrix4f &homogeneousMatrix)
set the matrix "A" of the comparison "p'Ap + 2v'p + c [OP] 0".
void transformComparison(const Eigen::Affine3f &transform)
transform the coordinate system of the comparison.
void setComparisonOperator(const pcl::ComparisonOps::CompareOp op)
set the operator "[OP]" of the comparison "p'Ap + 2v'p + c [OP] 0".
void setComparisonMatrix(const Eigen::Matrix3f &matrix)
set the matrix "A" of the comparison "p'Ap + 2v'p + c [OP] 0".
bool evaluate(const PointT &point) const override
Determine the result of this comparison.
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Definition: memory.h:86
Defines functions, macros and traits for allocating and using memory.
CompareOp
The kind of comparison operations that are possible within a comparison object.
A point structure representing Euclidean xyz coordinates, and the RGB color.