21 #ifndef otbSimplePointCountStrategy_h
22 #define otbSimplePointCountStrategy_h
42 template <
class TPo
intSet,
class TRadiusType,
class TIndexType>
53 inline float operator()(
const TPointSet* pointSet,
const TRadiusType& size,
const TIndexType& index)
57 double surface =
CONST_PI * size * size;
59 if (pointSet->GetNumberOfPoints() != 0)
61 typedef typename TPointSet::PointsContainer::ConstIterator iteratorType;
62 iteratorType it = pointSet->GetPoints()->Begin();
64 while (it != pointSet->GetPoints()->End())
66 float distX2 = (index[0] - it.Value()[0]) * (index[0] - it.Value()[0]);
67 float distY2 = (index[1] - it.Value()[1]) * (index[1] - it.Value()[1]);
68 float dist = std::sqrt(distX2 + distY2);
79 return static_cast<float>(accu / surface);
Compute the density of a neighborhood centerred in a pixel.
float operator()(const TPointSet *pointSet, const TRadiusType &size, const TIndexType &index)
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
constexpr double CONST_PI