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> 76 template <
typename Po
intT>
void 77 add (
const PointT& t) { xyz += t.getVector3fMap (); }
79 template <
typename Po
intT>
void 80 get (
PointT& t,
size_t n)
const { t.getVector3fMap () = xyz / n; }
82 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
99 template <
typename Po
intT>
void 100 add (
const PointT& t) { normal += t.getNormalVector4fMap (); }
102 template <
typename Po
intT>
void 105 #if EIGEN_VERSION_AT_LEAST (3, 3, 0) 106 t.getNormalVector4fMap () = normal.normalized ();
108 if (normal.squaredNorm() > 0)
109 t.getNormalVector4fMap () = normal.normalized ();
111 t.getNormalVector4fMap () = Eigen::Vector4f::Zero ();
115 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
130 template <
typename Po
intT>
void 133 template <
typename Po
intT>
void 134 get (
PointT& t,
size_t n)
const { t.curvature = curvature / n; }
149 template <
typename Po
intT>
void 152 r +=
static_cast<float> (t.r);
153 g +=
static_cast<float> (t.g);
154 b +=
static_cast<float> (t.b);
155 a +=
static_cast<float> (t.a);
158 template <
typename Po
intT>
void 161 t.rgba =
static_cast<uint32_t
> (a / n) << 24 |
162 static_cast<uint32_t> (r / n) << 16 |
163 static_cast<uint32_t
> (g / n) << 8 |
164 static_cast<uint32_t> (b / n);
180 template <
typename Po
intT>
void 183 template <
typename Po
intT>
void 184 get (
PointT& t,
size_t n)
const { t.intensity = intensity / n; }
200 template <
typename Po
intT>
void 203 std::map<uint32_t, size_t>::iterator itr = labels.find (t.label);
204 if (itr == labels.end ())
205 labels.insert (std::make_pair (t.label, 1));
210 template <
typename Po
intT>
void 214 std::map<uint32_t, size_t>::const_iterator itr;
215 for (itr = labels.begin (); itr != labels.end (); ++itr)
216 if (itr->second > max)
219 t.label = itr->first;
228 template <
typename Po
int1T,
typename Po
int2T = Po
int1T>
233 template <
typename AccumulatorT,
typename Po
intT>
234 struct IsCompatible : boost::mpl::apply<typename AccumulatorT::IsCompatible, PointT> { };
239 typename boost::fusion::result_of::as_vector<
240 typename boost::mpl::filter_view<
261 template <
typename Po
intT>
269 template <
typename AccumulatorT>
void 270 operator () (AccumulatorT& accumulator)
const 280 template <
typename Po
intT>
289 template <
typename AccumulatorT>
void 290 operator () (AccumulatorT& accumulator)
const 292 accumulator.get (p, n);
void add(const PointT &t)
void add(const PointT &t)
pcl::traits::has_xyz< boost::mpl::_1 > IsCompatible
AddPoint(const PointT &point)
boost::fusion::result_of::as_vector< typename boost::mpl::filter_view< boost::mpl::vector< AccumulatorXYZ, AccumulatorNormal, AccumulatorCurvature, AccumulatorRGBA, AccumulatorIntensity, AccumulatorLabel >, boost::mpl::and_< IsCompatible< boost::mpl::_1, Point1T >, IsCompatible< boost::mpl::_1, Point2T > > > >::type type
void add(const PointT &t)
void add(const PointT &t)
pcl::traits::has_normal< boost::mpl::_1 > IsCompatible
pcl::traits::has_intensity< boost::mpl::_1 > IsCompatible
pcl::traits::has_color< boost::mpl::_1 > IsCompatible
Defines all the PCL implemented PointT point type structures.
pcl::traits::has_curvature< boost::mpl::_1 > IsCompatible
void add(const PointT &t)
pcl::traits::has_label< boost::mpl::_1 > IsCompatible
void add(const PointT &t)
std::map< uint32_t, size_t > labels
A point structure representing Euclidean xyz coordinates, and the RGB color.
GetPoint(PointT &point, size_t num)