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> 46 namespace ComparisonOps
59 template<
typename Po
intT>
65 datatype_ (datatype), offset_ (offset)
74 compare (
const PointT& p,
const double& val);
87 template<
typename Po
intT>
91 typedef boost::shared_ptr< ComparisonBase<PointT> >
Ptr;
92 typedef boost::shared_ptr< const ComparisonBase<PointT> >
ConstPtr;
109 evaluate (
const PointT &point)
const = 0;
127 template<
typename Po
intT>
135 typedef boost::shared_ptr< FieldComparison<PointT> >
Ptr;
136 typedef boost::shared_ptr< const FieldComparison<PointT> >
ConstPtr;
151 , compare_val_ (src.compare_val_), point_data_ (src.point_data_)
174 evaluate (
const PointT &point)
const;
185 compare_val_ (), point_data_ ()
192 template<
typename Po
intT>
199 typedef boost::shared_ptr< PackedRGBComparison<PointT> >
Ptr;
200 typedef boost::shared_ptr< const PackedRGBComparison<PointT> >
ConstPtr;
217 evaluate (
const PointT &point)
const;
231 component_name_ (), component_offset_ (), compare_val_ ()
239 template<
typename Po
intT>
246 typedef boost::shared_ptr< PackedHSIComparison<PointT> >
Ptr;
247 typedef boost::shared_ptr< const PackedHSIComparison<PointT> >
ConstPtr;
264 evaluate (
const PointT &point)
const;
288 component_name_ (), component_id_ (), compare_val_ (), rgb_offset_ ()
308 template<
typename Po
intT>
312 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
314 typedef boost::shared_ptr<TfQuadraticXYZComparison<PointT> >
Ptr;
315 typedef boost::shared_ptr<const TfQuadraticXYZComparison<PointT> >
ConstPtr;
332 const Eigen::Vector3f &comparison_vector,
const float &comparison_scalar,
333 const Eigen::Affine3f &comparison_transform = Eigen::Affine3f::Identity ());
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_;
360 comp_matr_ = homogeneousMatrix;
361 tf_comp_matr_ = comp_matr_;
369 comp_vect_ = vector.homogeneous ();
370 tf_comp_vect_ = comp_vect_;
378 comp_vect_ = homogeneousVector;
379 tf_comp_vect_ = comp_vect_;
387 comp_scalar_ = scalar;
402 tf_comp_matr_ = transform.transpose () * comp_matr_ * transform;
403 tf_comp_vect_ = comp_vect_.transpose () * transform;
418 transformComparison (transform.matrix ());
426 evaluate (
const PointT &point)
const;
438 Eigen::Matrix4f tf_comp_matr_;
439 Eigen::Vector4f tf_comp_vect_;
444 template<
typename Po
intT>
452 typedef boost::shared_ptr<ConditionBase<PointT> >
Ptr;
453 typedef boost::shared_ptr<const ConditionBase<PointT> >
ConstPtr;
464 comparisons_.clear ();
467 conditions_.clear ();
474 addComparison (ComparisonBaseConstPtr comparison);
480 addCondition (Ptr condition);
493 evaluate (
const PointT &point)
const = 0;
508 template<
typename Po
intT>
515 typedef boost::shared_ptr<ConditionAnd<PointT> >
Ptr;
516 typedef boost::shared_ptr<const ConditionAnd<PointT> >
ConstPtr;
531 evaluate (
const PointT &point)
const;
536 template<
typename Po
intT>
543 typedef boost::shared_ptr<ConditionOr<PointT> >
Ptr;
544 typedef boost::shared_ptr<const ConditionOr<PointT> >
ConstPtr;
559 evaluate (
const PointT &point)
const;
593 template<
typename Po
intT>
619 Filter<
PointT>::
Filter (extract_removed_indices), capable_ (false), keep_organized_ (false), condition_ (),
620 user_filter_value_ (
std::numeric_limits<float>::quiet_NaN ())
622 filter_name_ =
"ConditionalRemoval";
630 PCL_DEPRECATED (
"ConditionalRemoval(ConditionBasePtr condition, bool extract_removed_indices = false) is deprecated, " 631 "please use the setCondition (ConditionBasePtr condition) function instead.")
633 Filter<
PointT>::
Filter (extract_removed_indices), capable_ (false), keep_organized_ (false), condition_ (),
634 user_filter_value_ (
std::numeric_limits<
float>::quiet_NaN ())
636 filter_name_ =
"ConditionalRemoval";
637 setCondition (condition);
651 keep_organized_ = val;
657 return (keep_organized_);
668 user_filter_value_ = val;
705 #ifdef PCL_NO_PRECOMPILE 706 #include <pcl/filters/impl/conditional_removal.hpp> void setComparisonMatrix(const Eigen::Matrix3f &matrix)
set the matrix "A" of the comparison "p'Ap + 2v'p + c [OP] 0".
A comparison whether the (x,y,z) components of a given point satisfy (p'Ap + 2v'p + c [OP] 0)...
ComparisonBase()
Constructor.
double compare_val_
All types (that we care about) can be represented as a double.
ComparisonBase::ConstPtr ComparisonBaseConstPtr
double compare_val_
All types (that we care about) can be represented as a double.
boost::shared_ptr< const PackedHSIComparison< PointT > > ConstPtr
ComparisonBase::Ptr ComparisonBasePtr
PointCloud::ConstPtr PointCloudConstPtr
virtual ~PackedHSIComparison()
Destructor.
uint32_t offset_
The data offset.
PointDataAtOffset< PointT > * point_data_
The point data to compare.
void setKeepOrganized(bool val)
Set whether the filtered points should be kept and set to the value given through setUserFilterValue ...
boost::shared_ptr< PackedRGBComparison< PointT > > Ptr
ComponentId component_id_
The ID of the component.
boost::shared_ptr< ConditionOr< PointT > > Ptr
uint32_t rgb_offset_
The offset of the component.
std::string component_name_
The name of the component.
bool capable_
True if capable.
void setComparisonOperator(const pcl::ComparisonOps::CompareOp op)
set the operator "[OP]" of the comparison "p'Ap + 2v'p + c [OP] 0".
void setUserFilterValue(float val)
Provide a value that the filtered points should be set to instead of removing them.
uint32_t offset_
The data offset.
ConditionAnd()
Constructor.
boost::shared_ptr< ConditionAnd< PointT > > Ptr
boost::shared_ptr< const TfQuadraticXYZComparison< PointT > > ConstPtr
bool isCapable() const
Return if the comparison is capable.
A datatype that enables type-correct comparisons.
uint8_t datatype_
The type of data.
float user_filter_value_
User given value to be set to any filtered point.
void transformComparison(const Eigen::Affine3f &transform)
transform the coordinate system of the comparison.
The (abstract) base class for the comparison object.
void setComparisonVector(const Eigen::Vector3f &vector)
set the vector "v" of the comparison "p'Ap + 2v'p + c [OP] 0".
ConditionOr()
Constructor.
virtual ~PackedRGBComparison()
Destructor.
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.
pcl::ConditionBase< PointT > ConditionBase
boost::shared_ptr< const ComparisonBase< PointT > > ConstPtr
ComparisonOps::CompareOp op_
The comparison operator type.
boost::shared_ptr< FieldComparison< PointT > > Ptr
ConditionalRemoval(int extract_removed_indices=false)
the default constructor.
PointDataAtOffset(uint8_t datatype, uint32_t offset)
Constructor.
ConditionalRemoval filters data that satisfies certain conditions.
boost::shared_ptr< PointCloud< PointT > > Ptr
virtual ~TfQuadraticXYZComparison()
Empty destructor.
PointCloud::Ptr PointCloudPtr
bool capable_
True if capable.
Filter represents the base filter class.
boost::shared_ptr< PackedHSIComparison< PointT > > Ptr
virtual ~ComparisonBase()
Destructor.
ConditionBasePtr condition_
The condition to use for filtering.
boost::shared_ptr< const ConditionBase< PointT > > ConstPtr
Eigen::Vector4f comp_vect_
bool getKeepOrganized() const
The field-based specialization of the comparison object.
boost::shared_ptr< const FieldComparison< PointT > > ConstPtr
void setComparisonMatrix(const Eigen::Matrix4f &homogeneousMatrix)
set the matrix "A" of the comparison "p'Ap + 2v'p + c [OP] 0".
A packed rgb specialization of the comparison object.
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef boost::shared_ptr< TfQuadraticXYZComparison< PointT > > Ptr
bool capable_
True if capable.
std::string component_name_
The name of the component.
bool keep_organized_
Keep the structure of the data organized, by setting the filtered points to the a user given value (N...
uint32_t component_offset_
The offset of the component.
boost::shared_ptr< const PointCloud< PointT > > ConstPtr
void transformComparison(const Eigen::Matrix4f &transform)
transform the coordinate system of the comparison.
std::string field_name_
Field name to compare data on.
CompareOp
The kind of comparison operations that are possible within a comparison object.
pcl::ComparisonBase< PointT > ComparisonBase
PointCloud represents the base class in PCL for storing collections of 3D points. ...
void setComparisonScalar(const float &scalar)
set the scalar "c" of the comparison "p'Ap + 2v'p + c [OP] 0".
ConditionBase()
Constructor.
ConditionBase::ConstPtr ConditionBaseConstPtr
boost::shared_ptr< const ConditionAnd< PointT > > ConstPtr
boost::shared_ptr< ComparisonBase< PointT > > Ptr
FieldComparison(const FieldComparison &src)
Copy constructor.
Eigen::Matrix4f comp_matr_
boost::shared_ptr< const ConditionOr< PointT > > ConstPtr
double compare_val_
All types (that we care about) can be represented as a double.
std::vector< ComparisonBaseConstPtr > comparisons_
The collection of all comparisons that need to be verified.
ConditionBase::Ptr ConditionBasePtr
A packed HSI specialization of the comparison object.
virtual ~ConditionBase()
Destructor.
A point structure representing Euclidean xyz coordinates, and the RGB color.
std::vector< Ptr > conditions_
The collection of all conditions that need to be verified.
boost::shared_ptr< ConditionBase< PointT > > Ptr
boost::shared_ptr< const PackedRGBComparison< PointT > > ConstPtr