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