47 template<std::
size_t dim>
53 const auto& d = (*data)[0];
58 if(std::size_t(d)<
idx)
98 template<std::
size_t dim>
104 const std::size_t nbData = (*data).size() - 1;
105 const std::size_t randId =
106 static_cast<std::size_t
>( nbData *
107 (
static_cast<float>(std::rand()/
static_cast<float>(RAND_MAX))));
109 const auto& d = (*data)[randId];
114 if(std::size_t(d)<
idx)
146 template<std::
size_t dim>
153 const int timeDim(
pts.
times.rows());
156 const std::size_t nbData = (*data).size();
158 const auto& d = (*data)[0];
162 if(std::size_t(d)<
idx)
166 for(std::size_t
id=1;
id<nbData;++id)
169 const auto& curId = (*data)[id];
170 std::size_t i = curId;
173 if(std::size_t(curId)<
idx)
176 for (
int f = 0; f < (featDim - 1); ++f)
180 for (
int d = 0; d < descDim; ++d)
184 for (
int t = 0; t < timeDim; ++t)
189 for (
int f = 0; f < (featDim - 1); ++f)
193 for (
int d = 0; d < descDim; ++d)
197 for (
int t = 0; t < timeDim; ++t)
218 template<std::
size_t dim>
224 const std::size_t nbData = (*data).size();
227 return (p1 - p2).norm();
232 for(std::size_t i=0;i<
dim;++i) center(i)=
T(0.);
234 for(std::size_t
id=0;
id<nbData;++id)
237 const auto& curId = (*data)[id];
238 std::size_t i = curId;
241 if(std::size_t(curId)<
idx)
244 for (std::size_t f = 0; f <
dim; ++f)
247 for(std::size_t i=0;i<
dim;++i) center(i)/=
T(nbData);
250 T minDist = std::numeric_limits<T>::max();
251 std::size_t medId = 0;
253 for(std::size_t
id=0;
id<nbData;++id)
256 const auto curId = (*data)[id];
257 std::size_t i = curId;
260 if(std::size_t(curId)<
idx)
285 template <
typename T>
290 maxPointByNode{Parametrizable::get<std::size_t>(
"maxPointByNode")},
295 const int sm = this->
template get<int>(
"samplingMethod");
304 template <
typename T>
313 template <
typename T>
316 const std::size_t featDim = cloud.
features.rows();
318 assert(featDim == 4 or featDim == 3);
321 this->sample<2>(cloud);
324 this->sample<3>(cloud);
328 template<std::
size_t dim>
337 case SamplingMethod::FIRST_PTS:
344 case SamplingMethod::RAND_PTS:
351 case SamplingMethod::CENTROID:
358 case SamplingMethod::MEDOID:
OctreeGridDataPointsFilter()
Matrix descriptors
descriptors of points in the cloud, might be empty
SamplingMethod samplingMethod
virtual DataPoints filter(const DataPoints &input)
Apply filters to input point cloud. This is the non-destructive version and returns a copy...
static const ParametersDoc availableParameters()
DataContainer * getData()
std::size_t maxPointByNode
FirstPtsSampler(DataPoints &dp)
Functions and classes that are dependant on scalar type are defined in this templatized class...
RandomPtsSampler(DataPoints &dp)
CentroidSampler(DataPoints &dp)
A data filter takes a point cloud as input, transforms it, and produces another point cloud as output...
Parametrizable::Parameters Parameters
void swapCols(Index iCol, Index jCol)
Swap column i and j in the point cloud, swap also features and descriptors if any. Assumes sizes are similar.
Data Filter based on Octree representation.
bool operator()(Octree_< T, dim > &oc)
An exception thrown when one tries to fetch the value of an unexisting parameter. ...
void conservativeResize(Index pointCount)
Resize the cloud to pointCount points, conserving existing ones.
Eigen::Matrix< T, dim, 1 > Point
virtual void inPlaceFilter(DataPoints &cloud)
Apply these filters to a point cloud without copying.
bool operator()(Octree_< T, dim > &oc)
bool operator()(Octree_< T, dim > &oc)
std::unordered_map< std::size_t, std::size_t > mapidx
Int64Matrix times
time associated to each points, might be empty
bool operator()(Octree_< T, dim > &oc)
Matrix features
features of points in the cloud
MedoidSampler(DataPoints &dp)
void sample(DataPoints &cloud)
bool build(const DP &pts, size_t maxDataByNode=1, T maxSizeByNode=T(0.), bool parallelBuild=false)