39 #ifndef PCL_POINT_REPRESENTATION_H_ 40 #define PCL_POINT_REPRESENTATION_H_ 42 #include <pcl/point_types.h> 43 #include <pcl/pcl_macros.h> 44 #include <pcl/for_each_type.h> 54 template <
typename Po
intT>
74 typedef boost::shared_ptr<PointRepresentation<PointT> >
Ptr;
75 typedef boost::shared_ptr<const PointRepresentation<PointT> >
ConstPtr;
96 inline bool isTrivial()
const {
return trivial_ && alpha_.empty (); }
104 bool is_valid =
true;
108 const float* temp =
reinterpret_cast<const float*
>(&p);
112 if (!pcl_isfinite (temp[i]))
126 if (!pcl_isfinite (temp[i]))
141 template <
typename OutputType>
void 154 out[i] = temp[i] * alpha_[i];
165 alpha_.resize (nr_dimensions_);
167 alpha_[i] = rescale_array[i];
177 template <
typename Po
intDefault>
185 typedef boost::shared_ptr<DefaultPointRepresentation<PointDefault> >
Ptr;
186 typedef boost::shared_ptr<const DefaultPointRepresentation<PointDefault> >
ConstPtr;
210 const float* ptr =
reinterpret_cast<const float*
> (&p);
220 template <
typename Po
intDefault>
227 struct IncrementFunctor
229 IncrementFunctor (
int &n) : n_ (n)
234 template<
typename Key>
inline void operator () ()
243 struct NdCopyPointFunctor
247 NdCopyPointFunctor (
const PointDefault &p1,
float * p2)
248 : p1_ (reinterpret_cast<const Pod&>(p1)), p2_ (p2), f_idx_ (0) { }
250 template<
typename Key>
inline void operator() ()
258 template <
typename Key,
typename FieldT,
int NrDims>
261 static void copyPoint (
const Pod &p1,
float * p2,
int &f_idx)
263 const uint8_t * data_ptr =
reinterpret_cast<const uint8_t *
> (&p1) +
265 p2[f_idx++] = *
reinterpret_cast<const FieldT*
> (data_ptr);
269 template <
typename Key,
typename FieldT,
int NrDims>
270 struct Helper<Key, FieldT[NrDims], NrDims>
272 static void copyPoint (
const Pod &p1,
float * p2,
int &f_idx)
274 const uint8_t * data_ptr =
reinterpret_cast<const uint8_t *
> (&p1) +
276 int nr_dims = NrDims;
277 const FieldT * array =
reinterpret_cast<const FieldT *
> (data_ptr);
278 for (
int i = 0; i < nr_dims; ++i)
280 p2[f_idx++] = array[i];
293 typedef typename boost::shared_ptr<DefaultFeatureRepresentation<PointDefault> >
Ptr;
294 typedef typename boost::shared_ptr<const DefaultFeatureRepresentation<PointDefault> >
ConstPtr;
300 pcl::for_each_type <FieldList> (IncrementFunctor (
nr_dimensions_));
312 pcl::for_each_type <FieldList> (NdCopyPointFunctor (p, out));
516 template <
typename Po
intDefault>
523 typedef boost::shared_ptr<CustomPointRepresentation<PointDefault> >
Ptr;
524 typedef boost::shared_ptr<const CustomPointRepresentation<PointDefault> >
ConstPtr;
531 : max_dim_(max_dim), start_dim_(start_dim)
534 nr_dimensions_ =
static_cast<int> (
sizeof (PointDefault) /
sizeof (
float)) - start_dim_;
554 const float *ptr = (
reinterpret_cast<const float*
> (&p)) + start_dim_;
567 #endif // #ifndef PCL_POINT_REPRESENTATION_H_ DefaultPointRepresentation()
DefaultPointRepresentation()
DefaultPointRepresentation()
virtual void copyToFloatArray(const PointT &p, float *out) const =0
Copy point data from input point to a float array.
A point structure representing a Shape Context.
virtual void copyToFloatArray(const PPFSignature &p, float *out) const
Copy point data from input point to a float array.
virtual void copyToFloatArray(const SHOT1344 &p, float *out) const
Copy point data from input point to a float array.
bool isTrivial() const
Returns whether this point representation is trivial.
A point structure representing the Normal Based Signature for a feature matrix of 4-by-3...
boost::shared_ptr< const DefaultPointRepresentation< PointDefault > > ConstPtr
A point structure representing a Unique Shape Context.
virtual void copyToFloatArray(const ShapeContext1980 &p, float *out) const
Copy point data from input point to a float array.
pcl::traits::fieldList< PointDefault >::type FieldList
DefaultPointRepresentation()
CustomPointRepresentation(const int max_dim=3, const int start_dim=0)
Constructor.
boost::shared_ptr< const PointRepresentation< PointT > > ConstPtr
boost::shared_ptr< DefaultFeatureRepresentation< PointDefault > > Ptr
virtual void copyToFloatArray(const PointDefault &p, float *out) const
Copy point data from input point to a float array.
virtual bool isValid(const PointT &p) const
Verify that the input point is valid.
boost::shared_ptr< const DefaultFeatureRepresentation< PointDefault > > ConstPtr
virtual void copyToFloatArray(const SHOT352 &p, float *out) const
Copy point data from input point to a float array.
A point structure representing the Fast Point Feature Histogram (FPFH).
int max_dim_
Use at most this many dimensions (i.e.
boost::shared_ptr< DefaultPointRepresentation< PointDefault > > Ptr
PointRepresentation()
Empty constructor.
DefaultFeatureRepresentation()
PointRepresentation provides a set of methods for converting a point structs/object into an n-dimensi...
CustomPointRepresentation extends PointRepresentation to allow for sub-part selection on the point...
A point structure representing the Point Feature Histogram with colors (PFHRGB).
boost::shared_ptr< PointRepresentation< PointT > > Ptr
int start_dim_
Use dimensions only starting with this one (i.e.
int nr_dimensions_
The number of dimensions in this point's vector (i.e.
A point structure representing Euclidean xyz coordinates.
boost::shared_ptr< CustomPointRepresentation< PointDefault > > Ptr
virtual ~PointRepresentation()
Empty destructor.
DefaultPointRepresentation()
DefaultPointRepresentation()
static void copyPoint(const Pod &p1, float *p2, int &f_idx)
void vectorize(const PointT &p, OutputType &out) const
Convert input point into a vector representation, rescaling by alpha.
A point structure representing the generic Signature of Histograms of OrienTations (SHOT) - shape onl...
virtual void copyToFloatArray(const PointXYZI &p, float *out) const
Copy point data from input point to a float array.
std::vector< float > alpha_
A vector containing the rescale factor to apply to each dimension.
bool trivial_
Indicates whether this point representation is trivial.
static void copyPoint(const Pod &p1, float *p2, int &f_idx)
virtual void copyToFloatArray(const PointDefault &p, float *out) const
Copy point data from input point to a float array.
A point structure representing Euclidean xyz coordinates, together with normal coordinates and the su...
DefaultPointRepresentation()
virtual void copyToFloatArray(const UniqueShapeContext1960 &p, float *out) const
Copy point data from input point to a float array.
DefaultPointRepresentation()
DefaultPointRepresentation extends PointRepresentation to define default behavior for common point ty...
DefaulFeatureRepresentation extends PointRepresentation and is intended to be used when defining the ...
boost::shared_ptr< const CustomPointRepresentation< PointDefault > > ConstPtr
A point structure representing the generic Signature of Histograms of OrienTations (SHOT) - shape+col...
virtual ~DefaultPointRepresentation()
int getNumberOfDimensions() const
Return the number of dimensions in the point's vector representation.
A point structure representing the Viewpoint Feature Histogram (VFH).
A point structure representing the Narf descriptor.
A point structure representing Euclidean xyz coordinates, and the RGB color.
A point structure representing the Point Feature Histogram (PFH).
void setRescaleValues(const float *rescale_array)
Set the rescale values to use when vectorizing points.
virtual void copyToFloatArray(const PointDefault &p, float *out) const
Copy the point data into a float array.
virtual void copyToFloatArray(const PointXYZ &p, float *out) const
Copy point data from input point to a float array.
DefaultPointRepresentation()
void copyPoint(const PointInT &point_in, PointOutT &point_out)
Copy the fields of a source point into a target point.
DefaultPointRepresentation()
virtual void copyToFloatArray(const Narf36 &p, float *out) const
Copy point data from input point to a float array.
virtual void copyToFloatArray(const PointNormal &p, float *out) const
Copy point data from input point to a float array.
A point structure for storing the Point Pair Feature (PPF) values.