38 #ifndef PCL_COMMON_IMPL_DETAIL_ACCUMULATORS_HPP
39 #define PCL_COMMON_IMPL_DETAIL_ACCUMULATORS_HPP
43 #include <boost/mpl/filter_view.hpp>
44 #include <boost/fusion/include/mpl.hpp>
45 #include <boost/fusion/include/for_each.hpp>
46 #include <boost/fusion/include/as_vector.hpp>
47 #include <boost/fusion/include/filter_if.hpp>
75 Eigen::Vector3f
xyz = Eigen::Vector3f::Zero ();
77 template <
typename Po
intT>
void
80 template <
typename Po
intT>
void
81 get (
PointT& t, std::size_t n)
const { t.getVector3fMap () =
xyz / n; }
94 Eigen::Vector4f
normal = Eigen::Vector4f::Zero ();
98 template <
typename Po
intT>
void
101 template <
typename Po
intT>
void
104 #if EIGEN_VERSION_AT_LEAST (3, 3, 0)
105 t.getNormalVector4fMap () =
normal.normalized ();
107 if (
normal.squaredNorm() > 0)
108 t.getNormalVector4fMap () =
normal.normalized ();
110 t.getNormalVector4fMap () = Eigen::Vector4f::Zero ();
127 template <
typename Po
intT>
void
130 template <
typename Po
intT>
void
142 float r = 0,
g = 0,
b = 0,
a = 0;
144 template <
typename Po
intT>
void
147 r +=
static_cast<float> (t.r);
148 g +=
static_cast<float> (t.g);
149 b +=
static_cast<float> (t.b);
150 a +=
static_cast<float> (t.a);
153 template <
typename Po
intT>
void
156 t.rgba =
static_cast<std::uint32_t
> (
a / n) << 24 |
157 static_cast<std::uint32_t
> (
r / n) << 16 |
158 static_cast<std::uint32_t
> (
g / n) << 8 |
159 static_cast<std::uint32_t
> (
b / n);
173 template <
typename Po
intT>
void
176 template <
typename Po
intT>
void
189 std::map<std::uint32_t, std::size_t>
labels;
191 template <
typename Po
intT>
void
194 auto itr =
labels.find (t.label);
196 labels.insert (std::make_pair (t.label, 1));
201 template <
typename Po
intT>
void
205 for (
const auto &label :
labels)
206 if (label.second > max)
209 t.label = label.first;
217 template <
typename Po
int1T,
typename Po
int2T = Po
int1T>
220 template <
typename AccumulatorT>
222 boost::mpl::apply<typename AccumulatorT::IsCompatible, Point1T>,
223 boost::mpl::apply<typename AccumulatorT::IsCompatible, Point2T>
229 template <
typename Po
intT>
233 typename boost::fusion::result_of::as_vector<
234 typename boost::mpl::filter_view<
250 template <
typename Po
intT>
258 template <
typename AccumulatorT>
void
268 template <
typename Po
intT>
277 template <
typename AccumulatorT>
void
280 accumulator.get (
p,
n);
Defines all the PCL implemented PointT point type structures.
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Defines functions, macros and traits for allocating and using memory.
Defines all the PCL and non-PCL macros used.
A point structure representing Euclidean xyz coordinates, and the RGB color.
void add(const PointT &t)
void get(PointT &t, std::size_t n) const
pcl::traits::has_curvature< boost::mpl::_1 > IsCompatible
pcl::traits::has_intensity< boost::mpl::_1 > IsCompatible
void get(PointT &t, std::size_t n) const
void add(const PointT &t)
void get(PointT &t, std::size_t) const
pcl::traits::has_label< boost::mpl::_1 > IsCompatible
void add(const PointT &t)
std::map< std::uint32_t, std::size_t > labels
pcl::traits::has_normal< boost::mpl::_1 > IsCompatible
void get(PointT &t, std::size_t) const
void add(const PointT &t)
pcl::traits::has_color< boost::mpl::_1 > IsCompatible
void get(PointT &t, std::size_t n) const
void add(const PointT &t)
void get(PointT &t, std::size_t n) const
void add(const PointT &t)
pcl::traits::has_xyz< boost::mpl::_1 > IsCompatible
typename boost::fusion::result_of::as_vector< typename boost::mpl::filter_view< boost::mpl::vector< AccumulatorXYZ, AccumulatorNormal, AccumulatorCurvature, AccumulatorRGBA, AccumulatorIntensity, AccumulatorLabel >, IsAccumulatorCompatible< PointT > > >::type type
void operator()(AccumulatorT &accumulator) const
AddPoint(const PointT &point)
GetPoint(PointT &point, std::size_t num)
void operator()(AccumulatorT &accumulator) const