48 #include <pcl/for_each_type.h>
58 template <
typename Po
intT>
78 using Ptr = shared_ptr<PointRepresentation<PointT> >;
79 using ConstPtr = shared_ptr<const PointRepresentation<PointT> >;
106 bool is_valid =
true;
110 const float* temp =
reinterpret_cast<const float*
>(&p);
114 if (!std::isfinite (temp[i]))
128 if (!std::isfinite (temp[i]))
143 template <
typename OutputType>
void
156 out[i] = temp[i] *
alpha_[i];
196 template <
typename Po
intDefault>
204 using Ptr = shared_ptr<DefaultPointRepresentation<PointDefault> >;
205 using ConstPtr = shared_ptr<const DefaultPointRepresentation<PointDefault> >;
207 static constexpr
const std::int32_t
NR_DIMS = std::min<std::int32_t>(
sizeof (PointDefault) /
sizeof (
float), 3);
231 const float* ptr =
reinterpret_cast<const float*
> (&p);
240 template <
typename Po
intDefault>
247 struct IncrementFunctor
249 IncrementFunctor (
int &n) : n_ (n)
254 template<
typename Key>
inline void operator () ()
256 n_ += pcl::traits::datatype<PointDefault, Key>::size;
263 struct NdCopyPointFunctor
265 using Pod =
typename traits::POD<PointDefault>::type;
267 NdCopyPointFunctor (
const PointDefault &p1,
float * p2)
268 : p1_ (
reinterpret_cast<const Pod&
>(p1)), p2_ (p2) {}
270 template<
typename Key>
inline void operator() ()
272 using FieldT =
typename pcl::traits::datatype<PointDefault, Key>::type;
273 constexpr
int NrDims = pcl::traits::datatype<PointDefault, Key>::size;
278 template <
typename Key,
typename FieldT,
int NrDims>
281 static void copyPoint (
const Pod &p1,
float * p2,
int &f_idx)
283 const std::uint8_t * data_ptr =
reinterpret_cast<const std::uint8_t *
> (&p1) +
284 pcl::traits::offset<PointDefault, Key>::value;
285 p2[f_idx++] = *
reinterpret_cast<const FieldT*
> (data_ptr);
289 template <
typename Key,
typename FieldT,
int NrDims>
290 struct Helper<Key, FieldT[NrDims], NrDims>
292 static void copyPoint (
const Pod &p1,
float * p2,
int &f_idx)
294 const std::uint8_t * data_ptr =
reinterpret_cast<const std::uint8_t *
> (&p1) +
295 pcl::traits::offset<PointDefault, Key>::value;
296 int nr_dims = NrDims;
297 const FieldT * array =
reinterpret_cast<const FieldT *
> (data_ptr);
298 for (
int i = 0; i < nr_dims; ++i)
300 p2[f_idx++] = array[i];
313 using Ptr = shared_ptr<DefaultFeatureRepresentation<PointDefault>>;
314 using ConstPtr = shared_ptr<const DefaultFeatureRepresentation<PointDefault>>;
315 using FieldList =
typename pcl::traits::fieldList<PointDefault>::type;
317 static constexpr
const std::int32_t
NR_DIMS = pcl::detail::traits::descriptorSize_v<PointDefault>;
322 pcl::for_each_type <FieldList> (IncrementFunctor (
nr_dimensions_));
334 pcl::for_each_type <FieldList> (NdCopyPointFunctor (p, out));
343 static constexpr
const std::int32_t
NR_DIMS = 3;
365 static constexpr
const std::int32_t
NR_DIMS = 3;
388 static constexpr
const std::int32_t
NR_DIMS = 3;
420 static constexpr
const std::int32_t
NR_DIMS = 4;
468 static constexpr
const std::int32_t
NR_DIMS = 36;
493 static constexpr
const std::int32_t
NR_DIMS = 1980;
513 static constexpr
const std::int32_t
NR_DIMS = 1960;
533 static constexpr
const std::int32_t
NR_DIMS = 352;
553 static constexpr
const std::int32_t
NR_DIMS = 1344;
572 template <
typename Po
intDefault>
579 using Ptr = shared_ptr<CustomPointRepresentation<PointDefault> >;
580 using ConstPtr = shared_ptr<const CustomPointRepresentation<PointDefault> >;
610 const float *ptr = (
reinterpret_cast<const float*
> (&p)) +
start_dim_;
CustomPointRepresentation extends PointRepresentation to allow for sub-part selection on the point.
void copyToFloatArray(const PointDefault &p, float *out) const override
Copy the point data into a float array.
CustomPointRepresentation(const int max_dim=3, const int start_dim=0)
Constructor.
int max_dim_
Use at most this many dimensions (i.e.
shared_ptr< CustomPointRepresentation< PointDefault > > Ptr
shared_ptr< const CustomPointRepresentation< PointDefault > > ConstPtr
int start_dim_
Use dimensions only starting with this one (i.e.
DefaulFeatureRepresentation extends PointRepresentation and is intended to be used when defining the ...
shared_ptr< DefaultFeatureRepresentation< PointDefault > > Ptr
typename pcl::traits::fieldList< PointDefault >::type FieldList
static constexpr const std::int32_t NR_DIMS
void copyToFloatArray(const PointDefault &p, float *out) const override
Copy point data from input point to a float array.
DefaultFeatureRepresentation()
shared_ptr< const DefaultFeatureRepresentation< PointDefault > > ConstPtr
void copyToFloatArray(const Narf36 &p, float *out) const override
Copy point data from input point to a float array.
DefaultPointRepresentation()
void copyToFloatArray(const PPFSignature &p, float *out) const override
Copy point data from input point to a float array.
DefaultPointRepresentation()
DefaultPointRepresentation()
void copyToFloatArray(const PointNormal &p, float *out) const override
Copy point data from input point to a float array.
DefaultPointRepresentation()
void copyToFloatArray(const PointXYZ &p, float *out) const override
Copy point data from input point to a float array.
DefaultPointRepresentation()
void copyToFloatArray(const PointXYZI &p, float *out) const override
Copy point data from input point to a float array.
DefaultPointRepresentation()
void copyToFloatArray(const SHOT1344 &p, float *out) const override
Copy point data from input point to a float array.
DefaultPointRepresentation()
void copyToFloatArray(const SHOT352 &p, float *out) const override
Copy point data from input point to a float array.
DefaultPointRepresentation()
void copyToFloatArray(const ShapeContext1980 &p, float *out) const override
Copy point data from input point to a float array.
DefaultPointRepresentation()
void copyToFloatArray(const UniqueShapeContext1960 &p, float *out) const override
Copy point data from input point to a float array.
DefaultPointRepresentation extends PointRepresentation to define default behavior for common point ty...
shared_ptr< DefaultPointRepresentation< PointDefault > > Ptr
shared_ptr< const DefaultPointRepresentation< PointDefault > > ConstPtr
~DefaultPointRepresentation() override=default
DefaultPointRepresentation()
void copyToFloatArray(const PointDefault &p, float *out) const override
Copy point data from input point to a float array.
static constexpr const std::int32_t NR_DIMS
PointRepresentation provides a set of methods for converting a point structs/object into an n-dimensi...
void vectorize(const PointT &p, float *out) const
shared_ptr< const PointRepresentation< PointT > > ConstPtr
virtual void copyToFloatArray(const PointT &p, float *out) const =0
Copy point data from input point to a float array.
void vectorize(const PointT &p, std::vector< float > &out) const
int nr_dimensions_
The number of dimensions in this point's vector (i.e.
bool trivial_
Indicates whether this point representation is trivial.
int getNumberOfDimensions() const
Return the number of dimensions in the point's vector representation.
bool isTrivial() const
Returns whether this point representation is trivial.
void setRescaleValues(const float *rescale_array)
Set the rescale values to use when vectorizing points.
shared_ptr< PointRepresentation< PointT > > Ptr
std::vector< float > alpha_
A vector containing the rescale factor to apply to each dimension.
virtual bool isValid(const PointT &p) const
Verify that the input point is valid.
void vectorize(const PointT &p, OutputType &out) const
Convert input point into a vector representation, rescaling by alpha.
virtual ~PointRepresentation()=default
Empty destructor.
Defines all the PCL implemented PointT point type structures.
Defines functions, macros and traits for allocating and using memory.
Defines all the PCL and non-PCL macros used.
static void copyPoint(const Pod &p1, float *p2, int &f_idx)
static void copyPoint(const Pod &p1, float *p2, int &f_idx)
A point structure representing the Fast Point Feature Histogram (FPFH).
A point structure representing the Globally Aligned Spatial Distribution (GASD) shape descriptor.
A point structure representing the Globally Aligned Spatial Distribution (GASD) shape and color descr...
A point structure representing the Globally Aligned Spatial Distribution (GASD) shape and color descr...
A point structure representing the Narf descriptor.
A point structure representing the Normal Based Signature for a feature matrix of 4-by-3.
A point structure representing the Point Feature Histogram with colors (PFHRGB).
A point structure representing the Point Feature Histogram (PFH).
A point structure for storing the Point Pair Feature (PPF) values.
A point structure representing Euclidean xyz coordinates, together with normal coordinates and the su...
A point structure representing Euclidean xyz coordinates.
A point structure representing Euclidean xyz coordinates, and the RGB color.
A point structure representing the generic Signature of Histograms of OrienTations (SHOT) - shape+col...
A point structure representing the generic Signature of Histograms of OrienTations (SHOT) - shape onl...
A point structure representing a Shape Context.
A point structure representing a Unique Shape Context.
A point structure representing the Viewpoint Feature Histogram (VFH).