67 throw InvalidField(
"MaxDensityDataPointsFilter: Error, no densities found in descriptors.");
70 const int nbPointsIn = cloud.
features.cols();
72 const T lastDensity = densities.maxCoeff();
73 const int nbSaturatedPts = (densities.array() == lastDensity).count();
77 for (
int i = 0; i < nbPointsIn; ++i)
79 const T density(densities(0,i));
82 const float r = (float)std::rand()/(float)RAND_MAX;
86 if (density == lastDensity)
88 acceptRatio = acceptRatio * (1-nbSaturatedPts/nbPointsIn);
virtual DataPoints filter(const DataPoints &input)
Apply filters to input point cloud. This is the non-destructive version and returns a copy...
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...
virtual void inPlaceFilter(DataPoints &cloud)
Apply these filters to a point cloud without copying.
ConstView getDescriptorViewByName(const std::string &name) const
Get a const view on a descriptor by name, throw an exception if it does not exist.
PointMatcher< T >::DataPoints::InvalidField InvalidField
MaxDensityDataPointsFilter(const Parameters ¶ms=Parameters())
Constructor, uses parameter interface.
Functions and classes that are dependant on scalar type are defined in this templatized class...
bool descriptorExists(const std::string &name) const
Look if a descriptor with a given name exist.
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...
void conservativeResize(Index pointCount)
Resize the cloud to pointCount points, conserving existing ones.
Eigen::Block< Matrix > View
A view on a feature or descriptor.
Subsampling. Reduce the points number by randomly removing points with a dentsity higher than a tresh...
Matrix features
features of points in the cloud
PM::DataPointsFilter DataPointsFilter