69 throw InvalidParameter((boost::format(
"MaxQuantileOnAxisDataPointsFilter: Error, filtering on dimension number %1%, larger than feature dimensionality %2%") %
dim % cloud.
features.rows()).str());
71 const int nbPointsIn = cloud.
features.cols();
74 const int nbPointsOut = nbPointsIn *
ratio;
77 std::vector<T> values;
78 values.reserve(nbPointsIn);
79 for (
int x = 0;
x < nbPointsIn; ++
x)
83 std::nth_element(values.begin(), values.begin() + (values.size() *
ratio), values.end());
84 const T limit = values[nbPointsOut];
88 for (
int i = 0; i < nbPointsIn; ++i)
97 assert(j <= nbPointsOut);
102 const int nbPointsOut = nbPointsIn * (1 -
ratio);
105 std::vector<T> values;
106 values.reserve(nbPointsIn);
107 for (
int x = 0;
x < nbPointsIn; ++
x)
111 std::nth_element(values.begin(), values.begin() + (values.size() *
ratio), values.end());
113 const T limit = values[nbPointsIn-nbPointsOut];
117 for (
int i = 0; i < nbPointsIn; ++i)
126 assert(j <= nbPointsOut);
Parametrizable::Parameters Parameters
void setColFrom(Index thisCol, const DataPoints &that, Index thatCol)
Set column thisCol equal to column thatCol of that, copy features and descriptors if any...
Functions and classes that are dependant on scalar type are defined in this templatized class...
const M::mapped_type & get(const M &m, const typename M::key_type &k)
The superclass of classes that are constructed using generic parameters. This class provides the para...
virtual DataPoints filter(const DataPoints &input)
Apply filters to input point cloud. This is the non-destructive version and returns a copy...
void conservativeResize(Index pointCount)
Resize the cloud to pointCount points, conserving existing ones.
MaxQuantileOnAxisDataPointsFilter(const Parameters ¶ms=Parameters())
Constructor, uses parameter interface.
Parametrizable::InvalidParameter InvalidParameter
Subsampling. Filter points beyond a maximum quantile measured on a specific axis. ...
Matrix features
features of points in the cloud
PM::DataPointsFilter DataPointsFilter
virtual void inPlaceFilter(DataPoints &cloud)
Apply these filters to a point cloud without copying.