Point Cloud Library (PCL) 1.14.0
Loading...
Searching...
No Matches
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
44namespace pcl
45{
46 //////////////////////////////////////////////////////////////////////////////////////////
47 namespace ComparisonOps
48 {
49 /** \brief The kind of comparison operations that are possible within a
50 * comparison object
51 */
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:
84 };
85
86 //////////////////////////////////////////////////////////////////////////////////////////
87 /** \brief The (abstract) base class for the comparison object. */
88 template<typename PointT>
90 {
91 public:
92 using Ptr = shared_ptr<ComparisonBase<PointT> >;
93 using ConstPtr = shared_ptr<const ComparisonBase<PointT> >;
94
95 /** \brief Constructor. */
96 ComparisonBase () = default;
97
98 /** \brief Destructor. */
99 virtual ~ComparisonBase () = default;
100
101 /** \brief Return if the comparison is capable. */
102 inline bool
103 isCapable () const
104 {
105 return (capable_);
106 }
107
108 /** \brief Evaluate function. */
109 virtual bool
110 evaluate (const PointT &point) const = 0;
111
112 protected:
113 /** \brief True if capable. */
114 bool capable_{false};
115
116 /** \brief Field name to compare data on. */
117 std::string field_name_;
118
119 /** \brief The data offset. */
120 std::uint32_t offset_{0};
121
122 /** \brief The comparison operator type. */
124 };
125
126 //////////////////////////////////////////////////////////////////////////////////////////
127 /** \brief The field-based specialization of the comparison object. */
128 template<typename PointT>
129 class FieldComparison : public ComparisonBase<PointT>
130 {
134
135 public:
136 using Ptr = shared_ptr<FieldComparison<PointT> >;
137 using ConstPtr = shared_ptr<const FieldComparison<PointT> >;
138
139
140 /** \brief Construct a FieldComparison
141 * \param field_name the name of the field that contains the data we want to compare
142 * \param op the operator to use when making the comparison
143 * \param compare_val the constant value to compare the field value too
144 */
145 FieldComparison (const std::string &field_name, ComparisonOps::CompareOp op, double compare_val);
146
147 /** \brief Copy constructor.
148 * \param[in] src the field comparison object to copy into this
149 */
155
156 /** \brief Copy operator.
157 * \param[in] src the field comparison object to copy into this
158 */
159 inline FieldComparison&
161 {
164 return (*this);
165 }
166
167 /** \brief Destructor. */
168 ~FieldComparison () override;
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. */
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. */
211 ~PackedRGBComparison () override = default;
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. */
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. */
258 ~PackedHSIComparison () override = default;
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. */
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 radius and length, three comparisons need to be
303 * combined as AND condition:
304 * 1. side: A = [0 0 0, 0 1 0, 0 0 1]; v = [0, 0, 0]; c = -radius²; OP = LT (meaning "<")
305 * 2. bottom base: A = 0; v = [0.5, 0, 0]; c = -x_min; OP = GT
306 * 3. top base: A = 0; v = [0.5, 0, 0]; c = -x_max; OP = LT
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 */
324 ~TfQuadraticXYZComparison () override = default;
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
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_{true};
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 {
593 using Filter<PointT>::input_;
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 using Ptr = shared_ptr<ConditionalRemoval<PointT> >;
610 using ConstPtr = shared_ptr<const ConditionalRemoval<PointT> >;
611
612
613 /** \brief the default constructor.
614 *
615 * All ConditionalRemovals require a condition which can be set
616 * using the setCondition method
617 * \param extract_removed_indices extract filtered indices from indices vector
618 */
619 ConditionalRemoval (int extract_removed_indices = false) :
620 Filter<PointT>::Filter (extract_removed_indices), condition_ (),
621 user_filter_value_ (std::numeric_limits<float>::quiet_NaN ())
622 {
623 filter_name_ = "ConditionalRemoval";
624 }
625
626 /** \brief Set whether the filtered points should be kept and set to the
627 * value given through \a setUserFilterValue (default: NaN), or removed
628 * from the PointCloud, thus potentially breaking its organized
629 * structure. By default, points are removed.
630 *
631 * \param val set to true whether the filtered points should be kept and
632 * set to a given user value (default: NaN)
633 */
634 inline void
636 {
637 keep_organized_ = val;
638 }
639
640 inline bool
642 {
643 return (keep_organized_);
644 }
645
646 /** \brief Provide a value that the filtered points should be set to
647 * instead of removing them. Used in conjunction with \a
648 * setKeepOrganized ().
649 * \param val the user given value that the filtered point dimensions should be set to
650 */
651 inline void
653 {
654 user_filter_value_ = val;
655 }
656
657 /** \brief Set the condition that the filter will use.
658 * \param condition each point must satisfy this condition to avoid
659 * being removed by the filter
660 *
661 * All ConditionalRemovals require a condition
662 */
663 void
664 setCondition (ConditionBasePtr condition);
665
666 protected:
667 /** \brief Filter a Point Cloud.
668 * \param output the resultant point cloud message
669 */
670 void
671 applyFilter (PointCloud &output) override;
672
673 /** \brief True if capable. */
674 bool capable_{false};
675
676 /** \brief Keep the structure of the data organized, by setting the
677 * filtered points to the a user given value (NaN by default).
678 */
679 bool keep_organized_{false};
680
681 /** \brief The condition to use for filtering */
683
684 /** \brief User given value to be set to any filtered point. Casted to
685 * the correct field type.
686 */
688 };
689}
690
691#ifdef PCL_NO_PRECOMPILE
692#include <pcl/filters/impl/conditional_removal.hpp>
693#endif
The (abstract) base class for the comparison object.
shared_ptr< ComparisonBase< PointT > > Ptr
shared_ptr< const ComparisonBase< PointT > > ConstPtr
virtual bool evaluate(const PointT &point) const =0
Evaluate function.
ComparisonBase()=default
Constructor.
std::uint32_t offset_
The data offset.
ComparisonOps::CompareOp op_
The comparison operator type.
bool capable_
True if capable.
virtual ~ComparisonBase()=default
Destructor.
bool isCapable() const
Return if the comparison is capable.
std::string field_name_
Field name to compare data on.
bool evaluate(const PointT &point) const override
Determine if a point meets this condition.
shared_ptr< const ConditionAnd< PointT > > ConstPtr
shared_ptr< ConditionAnd< PointT > > Ptr
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.
virtual ~ConditionBase()=default
Destructor.
void addComparison(ComparisonBaseConstPtr comparison)
Add a new comparison.
shared_ptr< ConditionBase< PointT > > Ptr
shared_ptr< ConditionOr< PointT > > Ptr
ConditionOr()
Constructor.
bool evaluate(const PointT &point) const override
Determine if a point meets this condition.
shared_ptr< const ConditionOr< PointT > > ConstPtr
ConditionalRemoval filters data that satisfies certain conditions.
typename ConditionBase::ConstPtr ConditionBaseConstPtr
shared_ptr< const ConditionalRemoval< PointT > > ConstPtr
void applyFilter(PointCloud &output) override
Filter a Point Cloud.
ConditionalRemoval(int extract_removed_indices=false)
the default constructor.
void setCondition(ConditionBasePtr condition)
Set the condition that the filter will use.
bool keep_organized_
Keep the structure of the data organized, by setting the filtered points to the a user given value (N...
void setUserFilterValue(float val)
Provide a value that the filtered points should be set to instead of removing them.
shared_ptr< ConditionalRemoval< PointT > > Ptr
ConditionBasePtr condition_
The condition to use for filtering.
typename ConditionBase::Ptr ConditionBasePtr
bool capable_
True if capable.
void setKeepOrganized(bool val)
Set whether the filtered points should be kept and set to the value given through setUserFilterValue ...
float user_filter_value_
User given value to be set to any filtered point.
The field-based specialization of the comparison object.
FieldComparison & operator=(const FieldComparison &src)
Copy operator.
~FieldComparison() override
Destructor.
double compare_val_
All types (that we care about) can be represented as a double.
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.
shared_ptr< const FieldComparison< PointT > > ConstPtr
shared_ptr< FieldComparison< PointT > > Ptr
Filter represents the base filter class.
Definition filter.h:81
bool extract_removed_indices_
Set to true if we want to return the indices of the removed points.
Definition filter.h:161
const std::string & getClassName() const
Get a string representation of the name of this class.
Definition filter.h:174
std::string filter_name_
The filter name.
Definition filter.h:158
IndicesPtr removed_indices_
Indices of the points that are removed.
Definition filter.h:155
PointCloudConstPtr input_
The input point cloud dataset.
Definition pcl_base.h:147
A packed HSI specialization of the comparison object.
~PackedHSIComparison() override=default
Destructor.
std::uint32_t rgb_offset_
The offset of the component.
bool evaluate(const PointT &point) const override
Determine the result of this comparison.
std::string component_name_
The name of the component.
shared_ptr< PackedHSIComparison< PointT > > Ptr
shared_ptr< const PackedHSIComparison< PointT > > ConstPtr
ComponentId component_id_
The ID of the component.
double compare_val_
All types (that we care about) can be represented as a double.
A packed rgb specialization of the comparison object.
bool evaluate(const PointT &point) const override
Determine the result of this comparison.
std::uint32_t component_offset_
The offset of the component.
double compare_val_
All types (that we care about) can be represented as a double.
~PackedRGBComparison() override=default
Destructor.
std::string component_name_
The name of the component.
shared_ptr< PackedRGBComparison< PointT > > Ptr
shared_ptr< const PackedRGBComparison< PointT > > ConstPtr
PointCloud represents the base class in PCL for storing collections of 3D points.
shared_ptr< PointCloud< PointT > > Ptr
shared_ptr< const PointCloud< PointT > > ConstPtr
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".
shared_ptr< TfQuadraticXYZComparison< PointT > > Ptr
void setComparisonScalar(const float &scalar)
set the scalar "c" of the comparison "p'Ap + 2v'p + c [OP] 0".
~TfQuadraticXYZComparison() override=default
Empty destructor.
void transformComparison(const Eigen::Matrix4f &transform)
transform the coordinate system of the comparison.
shared_ptr< const TfQuadraticXYZComparison< PointT > > ConstPtr
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.
A point structure representing Euclidean xyz coordinates, and the RGB color.