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