Point Cloud Library (PCL)  1.11.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 () : capable_ (false), offset_ (), op_ () {}
97 
98  /** \brief Destructor. */
99  virtual ~ComparisonBase () {}
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_;
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_;
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  {
163  point_data_ = src.point_data_;
164  return (*this);
165  }
166 
167  /** \brief Destructor. */
168  ~FieldComparison ();
169 
170  /** \brief Determine the result of this comparison.
171  * \param point the point to evaluate
172  * \return the result of this comparison.
173  */
174  bool
175  evaluate (const PointT &point) const override;
176 
177  protected:
178  /** \brief All types (that we care about) can be represented as a double. */
179  double compare_val_;
180 
181  /** \brief The point data to compare. */
183 
184  private:
185  FieldComparison () :
187  {
188  } // not allowed
189  };
190 
191  //////////////////////////////////////////////////////////////////////////////////////////
192  /** \brief A packed rgb specialization of the comparison object. */
193  template<typename PointT>
194  class PackedRGBComparison : public ComparisonBase<PointT>
195  {
198 
199  public:
200  using Ptr = shared_ptr<PackedRGBComparison<PointT> >;
201  using ConstPtr = shared_ptr<const PackedRGBComparison<PointT> >;
202 
203  /** \brief Construct a PackedRGBComparison
204  * \param component_name either "r", "g" or "b"
205  * \param op the operator to use when making the comparison
206  * \param compare_val the constant value to compare the component value too
207  */
208  PackedRGBComparison (const std::string &component_name, ComparisonOps::CompareOp op, double compare_val);
209 
210  /** \brief Destructor. */
212 
213  /** \brief Determine the result of this comparison.
214  * \param point the point to evaluate
215  * \return the result of this comparison.
216  */
217  bool
218  evaluate (const PointT &point) const override;
219 
220  protected:
221  /** \brief The name of the component. */
222  std::string component_name_;
223 
224  /** \brief The offset of the component */
225  std::uint32_t component_offset_;
226 
227  /** \brief All types (that we care about) can be represented as a double. */
228  double compare_val_;
229 
230  private:
233  {
234  } // not allowed
235 
236  };
237 
238  //////////////////////////////////////////////////////////////////////////////////////////
239  /** \brief A packed HSI specialization of the comparison object. */
240  template<typename PointT>
241  class PackedHSIComparison : public ComparisonBase<PointT>
242  {
245 
246  public:
247  using Ptr = shared_ptr<PackedHSIComparison<PointT> >;
248  using ConstPtr = shared_ptr<const PackedHSIComparison<PointT> >;
249 
250  /** \brief Construct a PackedHSIComparison
251  * \param component_name either "h", "s" or "i"
252  * \param op the operator to use when making the comparison
253  * \param compare_val the constant value to compare the component value too
254  */
255  PackedHSIComparison (const std::string &component_name, ComparisonOps::CompareOp op, double compare_val);
256 
257  /** \brief Destructor. */
259 
260  /** \brief Determine the result of this comparison.
261  * \param point the point to evaluate
262  * \return the result of this comparison.
263  */
264  bool
265  evaluate (const PointT &point) const override;
266 
268  {
269  H, // -128 to 127 corresponds to -pi to pi
270  S, // 0 to 255
271  I // 0 to 255
272  };
273 
274  protected:
275  /** \brief The name of the component. */
276  std::string component_name_;
277 
278  /** \brief The ID of the component. */
280 
281  /** \brief All types (that we care about) can be represented as a double. */
282  double compare_val_;
283 
284  /** \brief The offset of the component */
285  std::uint32_t rgb_offset_;
286 
287  private:
290  {
291  } // not allowed
292  };
293 
294  //////////////////////////////////////////////////////////////////////////////////////////
295  /**\brief A comparison whether the (x,y,z) components of a given point satisfy (p'Ap + 2v'p + c [OP] 0).
296  * Here [OP] stands for the defined pcl::ComparisonOps, i.e. for GT, GE, LT, LE or EQ;
297  * p = (x,y,z) is a point of the point cloud; A is 3x3 matrix; v is the 3x1 vector; c is a scalar.
298  *
299  * One can also use TfQuadraticXYZComparison for simpler geometric shapes by defining the
300  * quadratic parts (i.e. the matrix A) to be zero. By combining different instances of
301  * TfQuadraticXYZComparison one can get more complex shapes. For example, to have a simple
302  * cylinder (along the x-axis) of specific length one needs three comparisons combined as AND condition:
303  * 1. The cylinder: A = [0 0 0, 0 1 0, 0 0 1]; v = [0, 0, 0]; c = radius²; OP = LT (meaning "<")
304  * 2. X-min limit: A = 0; v = [1, 0, 0]; c = x_min; OP = GT
305  * 3. X-max ...
306  *
307  * \author Julian Löchner
308  */
309  template<typename PointT>
311  {
312  public:
313  PCL_MAKE_ALIGNED_OPERATOR_NEW // needed whenever there is a fixed size Eigen:: vector or matrix in a class
314 
315  using Ptr = shared_ptr<TfQuadraticXYZComparison<PointT> >;
316  using ConstPtr = shared_ptr<const TfQuadraticXYZComparison<PointT> >;
317 
318  /** \brief Constructor.
319  */
321 
322  /** \brief Empty destructor */
324 
325  /** \brief Constructor.
326  * \param op the operator "[OP]" of the comparison "p'Ap + 2v'p + c [OP] 0".
327  * \param comparison_matrix the matrix "A" of the comparison "p'Ap + 2v'p + c [OP] 0".
328  * \param comparison_vector the vector "v" of the comparison "p'Ap + 2v'p + c [OP] 0".
329  * \param comparison_scalar the scalar "c" of the comparison "p'Ap + 2v'p + c [OP] 0".
330  * \param comparison_transform the transformation of the comparison.
331  */
332  TfQuadraticXYZComparison (const pcl::ComparisonOps::CompareOp op, const Eigen::Matrix3f &comparison_matrix,
333  const Eigen::Vector3f &comparison_vector, const float &comparison_scalar,
334  const Eigen::Affine3f &comparison_transform = Eigen::Affine3f::Identity ());
335 
336  /** \brief set the operator "[OP]" of the comparison "p'Ap + 2v'p + c [OP] 0".
337  */
338  inline void
340  {
341  op_ = op;
342  }
343 
344  /** \brief set the matrix "A" of the comparison "p'Ap + 2v'p + c [OP] 0".
345  */
346  inline void
347  setComparisonMatrix (const Eigen::Matrix3f &matrix)
348  {
349  //define comp_matr_ as an homogeneous matrix of the given matrix
350  comp_matr_.block<3, 3> (0, 0) = matrix;
351  comp_matr_.col (3) << 0, 0, 0, 1;
352  comp_matr_.block<1, 3> (3, 0) << 0, 0, 0;
353  tf_comp_matr_ = comp_matr_;
354  }
355 
356  /** \brief set the matrix "A" of the comparison "p'Ap + 2v'p + c [OP] 0".
357  */
358  inline void
359  setComparisonMatrix (const Eigen::Matrix4f &homogeneousMatrix)
360  {
361  comp_matr_ = homogeneousMatrix;
362  tf_comp_matr_ = comp_matr_;
363  }
364 
365  /** \brief set the vector "v" of the comparison "p'Ap + 2v'p + c [OP] 0".
366  */
367  inline void
368  setComparisonVector (const Eigen::Vector3f &vector)
369  {
370  comp_vect_ = vector.homogeneous ();
371  tf_comp_vect_ = comp_vect_;
372  }
373 
374  /** \brief set the vector "v" of the comparison "p'Ap + 2v'p + c [OP] 0".
375  */
376  inline void
377  setComparisonVector (const Eigen::Vector4f &homogeneousVector)
378  {
379  comp_vect_ = homogeneousVector;
380  tf_comp_vect_ = comp_vect_;
381  }
382 
383  /** \brief set the scalar "c" of the comparison "p'Ap + 2v'p + c [OP] 0".
384  */
385  inline void
386  setComparisonScalar (const float &scalar)
387  {
388  comp_scalar_ = scalar;
389  }
390 
391  /** \brief transform the coordinate system of the comparison. If you think of
392  * the transformation to be a translation and rotation of the comparison in the
393  * same coordinate system, you have to provide the inverse transformation.
394  * This function does not change the original definition of the comparison. Thus,
395  * each call of this function will assume the original definition of the comparison
396  * as starting point for the transformation.
397  *
398  * @param transform the transformation (rotation and translation) as an affine matrix.
399  */
400  inline void
401  transformComparison (const Eigen::Matrix4f &transform)
402  {
403  tf_comp_matr_ = transform.transpose () * comp_matr_ * transform;
404  tf_comp_vect_ = comp_vect_.transpose () * transform;
405  }
406 
407  /** \brief transform the coordinate system of the comparison. If you think of
408  * the transformation to be a translation and rotation of the comparison in the
409  * same coordinate system, you have to provide the inverse transformation.
410  * This function does not change the original definition of the comparison. Thus,
411  * each call of this function will assume the original definition of the comparison
412  * as starting point for the transformation.
413  *
414  * @param transform the transformation (rotation and translation) as an affine matrix.
415  */
416  inline void
417  transformComparison (const Eigen::Affine3f &transform)
418  {
419  transformComparison (transform.matrix ());
420  }
421 
422  /** \brief Determine the result of this comparison.
423  * \param point the point to evaluate
424  * \return the result of this comparison.
425  */
426  bool
427  evaluate (const PointT &point) const override;
428 
429  protected:
432 
433  Eigen::Matrix4f comp_matr_;
434  Eigen::Vector4f comp_vect_;
435 
437 
438  private:
439  Eigen::Matrix4f tf_comp_matr_;
440  Eigen::Vector4f tf_comp_vect_;
441  };
442 
443  //////////////////////////////////////////////////////////////////////////////////////////
444  /** \brief Base condition class. */
445  template<typename PointT>
447  {
448  public:
452 
453  using Ptr = shared_ptr<ConditionBase<PointT> >;
454  using ConstPtr = shared_ptr<const ConditionBase<PointT> >;
455 
456  /** \brief Constructor. */
458  {
459  }
460 
461  /** \brief Destructor. */
462  virtual ~ConditionBase () = default;
463 
464  /** \brief Add a new comparison
465  * \param comparison the comparison operator to add
466  */
467  void
469 
470  /** \brief Add a nested condition to this condition.
471  * \param condition the nested condition to be added
472  */
473  void
474  addCondition (Ptr condition);
475 
476  /** \brief Check if evaluation requirements are met. */
477  inline bool
478  isCapable () const
479  {
480  return (capable_);
481  }
482 
483  /** \brief Determine if a point meets this condition.
484  * \return whether the point meets this condition.
485  */
486  virtual bool
487  evaluate (const PointT &point) const = 0;
488 
489  protected:
490  /** \brief True if capable. */
491  bool capable_;
492 
493  /** \brief The collection of all comparisons that need to be verified. */
494  std::vector<ComparisonBaseConstPtr> comparisons_;
495 
496  /** \brief The collection of all conditions that need to be verified. */
497  std::vector<Ptr> conditions_;
498  };
499 
500  //////////////////////////////////////////////////////////////////////////////////////////
501  /** \brief AND condition. */
502  template<typename PointT>
503  class ConditionAnd : public ConditionBase<PointT>
504  {
507 
508  public:
509  using Ptr = shared_ptr<ConditionAnd<PointT> >;
510  using ConstPtr = shared_ptr<const ConditionAnd<PointT> >;
511 
512  /** \brief Constructor. */
515  {
516  }
517 
518  /** \brief Determine if a point meets this condition.
519  * \return whether the point meets this condition.
520  *
521  * The ConditionAnd evaluates to true when ALL
522  * comparisons and nested conditions evaluate to true
523  */
524  bool
525  evaluate (const PointT &point) const override;
526  };
527 
528  //////////////////////////////////////////////////////////////////////////////////////////
529  /** \brief OR condition. */
530  template<typename PointT>
531  class ConditionOr : public ConditionBase<PointT>
532  {
535 
536  public:
537  using Ptr = shared_ptr<ConditionOr<PointT> >;
538  using ConstPtr = shared_ptr<const ConditionOr<PointT> >;
539 
540  /** \brief Constructor. */
543  {
544  }
545 
546  /** \brief Determine if a point meets this condition.
547  * \return whether the point meets this condition.
548  *
549  * The ConditionOr evaluates to true when ANY
550  * comparisons or nested conditions evaluate to true
551  */
552  bool
553  evaluate (const PointT &point) const override;
554  };
555 
556  //////////////////////////////////////////////////////////////////////////////////////////
557  /** \brief @b ConditionalRemoval filters data that satisfies certain conditions.
558  *
559  * A ConditionalRemoval must be provided a condition. There are two types of
560  * conditions: ConditionAnd and ConditionOr. Conditions require one or more
561  * comparisons and/or other conditions. A comparison has a name, a
562  * comparison operator, and a value.
563  *
564  * An ConditionAnd will evaluate to true when ALL of its encapsulated
565  * comparisons and conditions are true.
566  *
567  * An ConditionOr will evaluate to true when ANY of its encapsulated
568  * comparisons and conditions are true.
569  *
570  * Depending on the derived type of the comparison, the name can correspond
571  * to a PointCloud field name, or a color component in rgb color space or
572  * hsi color space.
573  *
574  * Here is an example usage:
575  * \code
576  * // Build the condition
577  * pcl::ConditionAnd<PointT>::Ptr range_cond (new pcl::ConditionAnd<PointT> ());
578  * range_cond->addComparison (pcl::FieldComparison<PointT>::Ptr (new pcl::FieldComparison<PointT>("z", pcl::ComparisonOps::LT, 2.0)));
579  * range_cond->addComparison (pcl::FieldComparison<PointT>::Ptr (new pcl::FieldComparison<PointT>("z", pcl::ComparisonOps::GT, 0.0)));
580  * // Build the filter
581  * pcl::ConditionalRemoval<PointT> range_filt;
582  * range_filt.setCondition (range_cond);
583  * range_filt.setKeepOrganized (false);
584  * \endcode
585  *
586  * \author Louis LeGrand, Intel Labs Seattle
587  * \ingroup filters
588  */
589  template<typename PointT>
590  class ConditionalRemoval : public Filter<PointT>
591  {
595 
598 
599  using PointCloud = typename Filter<PointT>::PointCloud;
600  using PointCloudPtr = typename PointCloud::Ptr;
601  using PointCloudConstPtr = typename PointCloud::ConstPtr;
602 
603  public:
607 
608  /** \brief the default constructor.
609  *
610  * All ConditionalRemovals require a condition which can be set
611  * using the setCondition method
612  * \param extract_removed_indices extract filtered indices from indices vector
613  */
614  ConditionalRemoval (int extract_removed_indices = false) :
615  Filter<PointT>::Filter (extract_removed_indices), capable_ (false), keep_organized_ (false), condition_ (),
616  user_filter_value_ (std::numeric_limits<float>::quiet_NaN ())
617  {
618  filter_name_ = "ConditionalRemoval";
619  }
620 
621  /** \brief Set whether the filtered points should be kept and set to the
622  * value given through \a setUserFilterValue (default: NaN), or removed
623  * from the PointCloud, thus potentially breaking its organized
624  * structure. By default, points are removed.
625  *
626  * \param val set to true whether the filtered points should be kept and
627  * set to a given user value (default: NaN)
628  */
629  inline void
630  setKeepOrganized (bool val)
631  {
632  keep_organized_ = val;
633  }
634 
635  inline bool
637  {
638  return (keep_organized_);
639  }
640 
641  /** \brief Provide a value that the filtered points should be set to
642  * instead of removing them. Used in conjunction with \a
643  * setKeepOrganized ().
644  * \param val the user given value that the filtered point dimensions should be set to
645  */
646  inline void
647  setUserFilterValue (float val)
648  {
649  user_filter_value_ = val;
650  }
651 
652  /** \brief Set the condition that the filter will use.
653  * \param condition each point must satisfy this condition to avoid
654  * being removed by the filter
655  *
656  * All ConditionalRemovals require a condition
657  */
658  void
659  setCondition (ConditionBasePtr condition);
660 
661  protected:
662  /** \brief Filter a Point Cloud.
663  * \param output the resultant point cloud message
664  */
665  void
666  applyFilter (PointCloud &output) override;
667 
668  /** \brief True if capable. */
669  bool capable_;
670 
671  /** \brief Keep the structure of the data organized, by setting the
672  * filtered points to the a user given value (NaN by default).
673  */
675 
676  /** \brief The condition to use for filtering */
678 
679  /** \brief User given value to be set to any filtered point. Casted to
680  * the correct field type.
681  */
683  };
684 }
685 
686 #ifdef PCL_NO_PRECOMPILE
687 #include <pcl/filters/impl/conditional_removal.hpp>
688 #endif
pcl::ConditionOr::ConditionOr
ConditionOr()
Constructor.
Definition: conditional_removal.h:541
pcl
Definition: convolution.h:46
pcl::ConditionBase::Ptr
shared_ptr< ConditionBase< PointT > > Ptr
Definition: conditional_removal.h:453
pcl::PointDataAtOffset
A datatype that enables type-correct comparisons.
Definition: conditional_removal.h:61
pcl::PackedHSIComparison::H
@ H
Definition: conditional_removal.h:269
pcl::ComparisonBase::ComparisonBase
ComparisonBase()
Constructor.
Definition: conditional_removal.h:96
pcl::PackedHSIComparison::S
@ S
Definition: conditional_removal.h:270
pcl::PackedHSIComparison
A packed HSI specialization of the comparison object.
Definition: conditional_removal.h:241
pcl::PCLBase::PointCloudConstPtr
typename PointCloud::ConstPtr PointCloudConstPtr
Definition: pcl_base.h:74
pcl::PointDataAtOffset::offset_
std::uint32_t offset_
The data offset.
Definition: conditional_removal.h:81
pcl::PCLBase::PointCloudPtr
typename PointCloud::Ptr PointCloudPtr
Definition: pcl_base.h:73
pcl::ComparisonBase::evaluate
virtual bool evaluate(const PointT &point) const =0
Evaluate function.
pcl::ConditionalRemoval::ConditionBasePtr
typename ConditionBase::Ptr ConditionBasePtr
Definition: conditional_removal.h:605
pcl::PointDataAtOffset::PointDataAtOffset
PointDataAtOffset(std::uint8_t datatype, std::uint32_t offset)
Constructor.
Definition: conditional_removal.h:65
pcl::ComparisonBase::Ptr
shared_ptr< ComparisonBase< PointT > > Ptr
Definition: conditional_removal.h:92
pcl::ConditionBase::ConstPtr
shared_ptr< const ConditionBase< PointT > > ConstPtr
Definition: conditional_removal.h:454
pcl::ComparisonOps::LE
@ LE
Definition: conditional_removal.h:54
pcl::ComparisonBase
The (abstract) base class for the comparison object.
Definition: conditional_removal.h:89
pcl::PackedHSIComparison::I
@ I
Definition: conditional_removal.h:271
pcl::ConditionBase::isCapable
bool isCapable() const
Check if evaluation requirements are met.
Definition: conditional_removal.h:478
pcl::ComparisonOps::GE
@ GE
Definition: conditional_removal.h:54
pcl::ComparisonBase::capable_
bool capable_
True if capable.
Definition: conditional_removal.h:114
pcl::PackedHSIComparison::component_name_
std::string component_name_
The name of the component.
Definition: conditional_removal.h:276
pcl::TfQuadraticXYZComparison::setComparisonVector
void setComparisonVector(const Eigen::Vector4f &homogeneousVector)
set the vector "v" of the comparison "p'Ap + 2v'p + c [OP] 0".
Definition: conditional_removal.h:377
pcl::ConditionalRemoval::capable_
bool capable_
True if capable.
Definition: conditional_removal.h:669
pcl::PointDataAtOffset::datatype_
std::uint8_t datatype_
The type of data.
Definition: conditional_removal.h:78
pcl::ConditionalRemoval::getKeepOrganized
bool getKeepOrganized() const
Definition: conditional_removal.h:636
pcl::TfQuadraticXYZComparison::transformComparison
void transformComparison(const Eigen::Affine3f &transform)
transform the coordinate system of the comparison.
Definition: conditional_removal.h:417
pcl::ConditionBase::evaluate
virtual bool evaluate(const PointT &point) const =0
Determine if a point meets this condition.
pcl::ComparisonOps::LT
@ LT
Definition: conditional_removal.h:54
pcl::ComparisonBase::op_
ComparisonOps::CompareOp op_
The comparison operator type.
Definition: conditional_removal.h:123
pcl::PointCloud
PointCloud represents the base class in PCL for storing collections of 3D points.
Definition: distances.h:55
pcl::ConditionalRemoval::ConditionalRemoval
ConditionalRemoval(int extract_removed_indices=false)
the default constructor.
Definition: conditional_removal.h:614
pcl::TfQuadraticXYZComparison::setComparisonVector
void setComparisonVector(const Eigen::Vector3f &vector)
set the vector "v" of the comparison "p'Ap + 2v'p + c [OP] 0".
Definition: conditional_removal.h:368
pcl::ConditionBase::capable_
bool capable_
True if capable.
Definition: conditional_removal.h:491
pcl::PointXYZRGB
A point structure representing Euclidean xyz coordinates, and the RGB color.
Definition: point_types.hpp:628
pcl::FieldComparison::compare_val_
double compare_val_
All types (that we care about) can be represented as a double.
Definition: conditional_removal.h:179
pcl::TfQuadraticXYZComparison::evaluate
bool evaluate(const PointT &point) const override
Determine the result of this comparison.
Definition: conditional_removal.hpp:490
pcl::ComparisonOps::CompareOp
CompareOp
The kind of comparison operations that are possible within a comparison object.
Definition: conditional_removal.h:52
pcl::TfQuadraticXYZComparison::comp_scalar_
float comp_scalar_
Definition: conditional_removal.h:436
pcl::TfQuadraticXYZComparison::setComparisonOperator
void setComparisonOperator(const pcl::ComparisonOps::CompareOp op)
set the operator "[OP]" of the comparison "p'Ap + 2v'p + c [OP] 0".
Definition: conditional_removal.h:339
pcl::PointDataAtOffset::compare
int compare(const PointT &p, const double &val)
Compare function.
Definition: conditional_removal.hpp:520
pcl::ConditionBase::addCondition
void addCondition(Ptr condition)
Add a nested condition to this condition.
Definition: conditional_removal.hpp:597
pcl::PackedHSIComparison::compare_val_
double compare_val_
All types (that we care about) can be represented as a double.
Definition: conditional_removal.h:282
pcl::TfQuadraticXYZComparison::~TfQuadraticXYZComparison
~TfQuadraticXYZComparison()
Empty destructor.
Definition: conditional_removal.h:323
pcl::PackedRGBComparison
A packed rgb specialization of the comparison object.
Definition: conditional_removal.h:194
pcl::ConditionBase::addComparison
void addComparison(ComparisonBaseConstPtr comparison)
Add a new comparison.
Definition: conditional_removal.hpp:588
pcl::ComparisonBase::offset_
std::uint32_t offset_
The data offset.
Definition: conditional_removal.h:120
pcl::PackedHSIComparison::ComponentId
ComponentId
Definition: conditional_removal.h:267
pcl::ConditionalRemoval::setCondition
void setCondition(ConditionBasePtr condition)
Set the condition that the filter will use.
Definition: conditional_removal.hpp:644
pcl::ComparisonBase::~ComparisonBase
virtual ~ComparisonBase()
Destructor.
Definition: conditional_removal.h:99
pcl::ComparisonOps::EQ
@ EQ
Definition: conditional_removal.h:54
pcl::ConditionAnd::evaluate
bool evaluate(const PointT &point) const override
Determine if a point meets this condition.
Definition: conditional_removal.hpp:608
pcl::ComparisonBase::isCapable
bool isCapable() const
Return if the comparison is capable.
Definition: conditional_removal.h:103
pcl::TfQuadraticXYZComparison::setComparisonMatrix
void setComparisonMatrix(const Eigen::Matrix4f &homogeneousMatrix)
set the matrix "A" of the comparison "p'Ap + 2v'p + c [OP] 0".
Definition: conditional_removal.h:359
pcl::FieldComparison::evaluate
bool evaluate(const PointT &point) const override
Determine the result of this comparison.
Definition: conditional_removal.hpp:98
pcl::ConditionalRemoval::keep_organized_
bool keep_organized_
Keep the structure of the data organized, by setting the filtered points to the a user given value (N...
Definition: conditional_removal.h:674
pcl::PackedHSIComparison::~PackedHSIComparison
~PackedHSIComparison()
Destructor.
Definition: conditional_removal.h:258
pcl::ConditionalRemoval
ConditionalRemoval filters data that satisfies certain conditions.
Definition: conditional_removal.h:590
pcl::TfQuadraticXYZComparison::transformComparison
void transformComparison(const Eigen::Matrix4f &transform)
transform the coordinate system of the comparison.
Definition: conditional_removal.h:401
pcl::PackedRGBComparison::component_offset_
std::uint32_t component_offset_
The offset of the component.
Definition: conditional_removal.h:225
pcl::ComparisonBase::field_name_
std::string field_name_
Field name to compare data on.
Definition: conditional_removal.h:117
PCL_MAKE_ALIGNED_OPERATOR_NEW
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Definition: memory.h:63
pcl::TfQuadraticXYZComparison::TfQuadraticXYZComparison
TfQuadraticXYZComparison()
Constructor.
Definition: conditional_removal.hpp:369
pcl::FieldComparison::~FieldComparison
~FieldComparison()
Destructor.
Definition: conditional_removal.hpp:91
pcl::ConditionalRemoval::setUserFilterValue
void setUserFilterValue(float val)
Provide a value that the filtered points should be set to instead of removing them.
Definition: conditional_removal.h:647
pcl::PackedRGBComparison::compare_val_
double compare_val_
All types (that we care about) can be represented as a double.
Definition: conditional_removal.h:228
pcl::ConditionAnd::ConditionAnd
ConditionAnd()
Constructor.
Definition: conditional_removal.h:513
pcl::ConditionalRemoval::setKeepOrganized
void setKeepOrganized(bool val)
Set whether the filtered points should be kept and set to the value given through setUserFilterValue ...
Definition: conditional_removal.h:630
pcl::Filter
Filter represents the base filter class.
Definition: filter.h:80
pcl::ConditionalRemoval::ConditionBaseConstPtr
typename ConditionBase::ConstPtr ConditionBaseConstPtr
Definition: conditional_removal.h:606
pcl::ConditionBase::conditions_
std::vector< Ptr > conditions_
The collection of all conditions that need to be verified.
Definition: conditional_removal.h:497
pcl::ConditionBase::ComparisonBasePtr
typename ComparisonBase::Ptr ComparisonBasePtr
Definition: conditional_removal.h:450
pcl::TfQuadraticXYZComparison::comp_vect_
Eigen::Vector4f comp_vect_
Definition: conditional_removal.h:434
pcl::TfQuadraticXYZComparison
A comparison whether the (x,y,z) components of a given point satisfy (p'Ap + 2v'p + c [OP] 0).
Definition: conditional_removal.h:310
pcl::ConditionBase
Base condition class.
Definition: conditional_removal.h:446
pcl::FieldComparison::point_data_
PointDataAtOffset< PointT > * point_data_
The point data to compare.
Definition: conditional_removal.h:182
pcl::FieldComparison::operator=
FieldComparison & operator=(const FieldComparison &src)
Copy operator.
Definition: conditional_removal.h:160
pcl::PackedRGBComparison::~PackedRGBComparison
~PackedRGBComparison()
Destructor.
Definition: conditional_removal.h:211
pcl::ConditionalRemoval::applyFilter
void applyFilter(PointCloud &output) override
Filter a Point Cloud.
Definition: conditional_removal.hpp:652
pcl::PackedRGBComparison::component_name_
std::string component_name_
The name of the component.
Definition: conditional_removal.h:222
pcl::Filter::filter_name_
std::string filter_name_
The filter name.
Definition: filter.h:158
pcl::PointCloud::Ptr
shared_ptr< PointCloud< PointT > > Ptr
Definition: point_cloud.h:407
pcl::PackedRGBComparison::evaluate
bool evaluate(const PointT &point) const override
Determine the result of this comparison.
Definition: conditional_removal.hpp:193
pcl::ConditionBase::~ConditionBase
virtual ~ConditionBase()=default
Destructor.
pcl::TfQuadraticXYZComparison::comp_matr_
Eigen::Matrix4f comp_matr_
Definition: conditional_removal.h:433
pcl::PackedHSIComparison::evaluate
bool evaluate(const PointT &point) const override
Determine the result of this comparison.
Definition: conditional_removal.hpp:289
pcl::ConditionBase::ConditionBase
ConditionBase()
Constructor.
Definition: conditional_removal.h:457
pcl::ConditionBase::comparisons_
std::vector< ComparisonBaseConstPtr > comparisons_
The collection of all comparisons that need to be verified.
Definition: conditional_removal.h:494
pcl::TfQuadraticXYZComparison::setComparisonScalar
void setComparisonScalar(const float &scalar)
set the scalar "c" of the comparison "p'Ap + 2v'p + c [OP] 0".
Definition: conditional_removal.h:386
pcl::ConditionOr
OR condition.
Definition: conditional_removal.h:531
pcl::PointCloud::ConstPtr
shared_ptr< const PointCloud< PointT > > ConstPtr
Definition: point_cloud.h:408
pcl::ComparisonBase::ConstPtr
shared_ptr< const ComparisonBase< PointT > > ConstPtr
Definition: conditional_removal.h:93
pcl::PackedHSIComparison::rgb_offset_
std::uint32_t rgb_offset_
The offset of the component.
Definition: conditional_removal.h:285
pcl::ConditionalRemoval::user_filter_value_
float user_filter_value_
User given value to be set to any filtered point.
Definition: conditional_removal.h:682
pcl::ConditionAnd
AND condition.
Definition: conditional_removal.h:503
pcl::ComparisonOps::GT
@ GT
Definition: conditional_removal.h:54
pcl::ConditionOr::evaluate
bool evaluate(const PointT &point) const override
Determine if a point meets this condition.
Definition: conditional_removal.hpp:625
pcl::PackedHSIComparison::component_id_
ComponentId component_id_
The ID of the component.
Definition: conditional_removal.h:279
memory.h
Defines functions, macros and traits for allocating and using memory.
pcl::TfQuadraticXYZComparison::setComparisonMatrix
void setComparisonMatrix(const Eigen::Matrix3f &matrix)
set the matrix "A" of the comparison "p'Ap + 2v'p + c [OP] 0".
Definition: conditional_removal.h:347
pcl::ConditionBase::ComparisonBaseConstPtr
typename ComparisonBase::ConstPtr ComparisonBaseConstPtr
Definition: conditional_removal.h:451
pcl::FieldComparison::FieldComparison
FieldComparison(const FieldComparison &src)
Copy constructor.
Definition: conditional_removal.h:150
pcl::FieldComparison
The field-based specialization of the comparison object.
Definition: conditional_removal.h:129
pcl::ConditionalRemoval::condition_
ConditionBasePtr condition_
The condition to use for filtering.
Definition: conditional_removal.h:677