Loading...
Searching...
No Matches
features.hpp
/*
* Software License Agreement (BSD License)
*
* Copyright (c) 2011, Willow Garage, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of Willow Garage, Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* Author: Anatoly Baskeheev, Itseez Ltd, (myname.mysurname@mycompany.com)
*/
#ifndef _PCL_GPU_FEATURES_HPP_
#define _PCL_GPU_FEATURES_HPP_
#include <pcl/pcl_macros.h>
#include <pcl/point_types.h>
#include <pcl/gpu/containers/device_array.h>
#include <pcl/gpu/octree/device_format.hpp>
#include <pcl/gpu/octree/octree.hpp>
namespace pcl
{
namespace gpu
{
////////////////////////////////////////////////////////////////////////////////////////////
/** \brief @b Feature represents the base feature class. */
struct PCL_EXPORTS Feature
{
public:
using PointType = PointXYZ;
using NormalType = PointXYZ;
using PointCloud = DeviceArray<PointType>;
using Normals = DeviceArray<NormalType>;
using Indices = DeviceArray<int>;
Feature();
void setInputCloud(const PointCloud& cloud);
void setSearchSurface(const PointCloud& surface);
void setIndices(const Indices& indices);
void setRadiusSearch(float radius, int max_results);
protected:
PointCloud cloud_;
PointCloud surface_;
Indices indices_;
float radius_;
int max_results_;
Octree octree_;
};
////////////////////////////////////////////////////////////////////////////////////////////
/** \brief @b Feature represents the base feature class that takes normals as input also. */
struct PCL_EXPORTS FeatureFromNormals : public Feature
{
public:
void setInputNormals(const Normals& normals);
protected:
Normals normals_;
};
////////////////////////////////////////////////////////////////////////////////////////////
/** \brief @b Class for normal estimation. */
class PCL_EXPORTS NormalEstimation : public Feature
{
public:
// float x, y, z, curvature; -> sizeof(PointXYZ) = 4 * sizeof(float)
using NormalType = Feature::NormalType;
NormalEstimation();
void compute(Normals& normals);
void setViewPoint(float vpx, float vpy, float vpz);
void getViewPoint(float& vpx, float& vpy, float& vpz) const;
static void computeNormals(const PointCloud& cloud, const NeighborIndices& nn_indices, Normals& normals);
static void flipNormalTowardsViewpoint(const PointCloud& cloud, float vp_x, float vp_y, float vp_z, Normals& normals);
static void flipNormalTowardsViewpoint(const PointCloud& cloud, const Indices& indices, float vp_x, float vp_y, float vp_z, Normals& normals);
private:
float vpx_, vpy_, vpz_;
NeighborIndices nn_indices_;
};
////////////////////////////////////////////////////////////////////////////////////////////
/** \brief @b Class for PFH estimation. */
class PCL_EXPORTS PFHEstimation : public FeatureFromNormals
{
public:
void compute(const PointCloud& cloud, const Normals& normals, const NeighborIndices& neighb_indices, DeviceArray2D<PFHSignature125>& features);
void compute(DeviceArray2D<PFHSignature125>& features);
private:
NeighborIndices nn_indices_;
DeviceArray2D<float> data_rpk;
int max_elems_rpk;
};
////////////////////////////////////////////////////////////////////////////////////////////
/** \brief @b Class for PFHRGB estimation. */
class PCL_EXPORTS PFHRGBEstimation : public FeatureFromNormals
{
public:
using PointType = PointXYZ; //16 bytes for xyzrgb
void compute(const PointCloud& cloud, const Normals& normals, const NeighborIndices& neighb_indices, DeviceArray2D<PFHRGBSignature250>& features);
void compute(DeviceArray2D<PFHRGBSignature250>& features);
private:
NeighborIndices nn_indices_;
DeviceArray2D<float> data_rpk;
int max_elems_rpk;
};
////////////////////////////////////////////////////////////////////////////////////////////
/** \brief @b Class for FPFH estimation. */
class PCL_EXPORTS FPFHEstimation : public FeatureFromNormals
{
public:
FPFHEstimation();
void compute(DeviceArray2D<FPFHSignature33>& features);
void compute(const PointCloud& cloud, const Normals& normals, const NeighborIndices& neighbours, DeviceArray2D<FPFHSignature33>& features);
private:
NeighborIndices nn_indices_, nn_indices2_;
DeviceArray<int> unique_indices_storage;
DeviceArray<int> lookup;
DeviceArray2D<FPFHSignature33> spfh;
};
//////////////////////////////////////////////////////////////////////////////////////////////
///** \brief @b Class for PPF estimation. */
class PCL_EXPORTS PPFEstimation : public FeatureFromNormals
{
public:
void compute(DeviceArray<PPFSignature>& features);
};
//////////////////////////////////////////////////////////////////////////////////////////////
///** \brief @b Class for PPFRGB estimation. */
class PCL_EXPORTS PPFRGBEstimation : public FeatureFromNormals
{
public:
using PointType = PointXYZ; //16 bytes for xyzrgb
void compute(DeviceArray<PPFRGBSignature>& features);
};
//////////////////////////////////////////////////////////////////////////////////////////////
///** \brief @b Class for PPFRGBRegion estimation. */
class PCL_EXPORTS PPFRGBRegionEstimation : public FeatureFromNormals
{
public:
using PointType = PointXYZ; //16 bytes for xyzrgb
void compute(DeviceArray<PPFRGBSignature>& features);
private:
NeighborIndices nn_indices_;
};
//////////////////////////////////////////////////////////////////////////////////////////////
///** \brief @b Class for PPFRGBRegion estimation. */
class PCL_EXPORTS PrincipalCurvaturesEstimation : public FeatureFromNormals
{
public:
void compute(DeviceArray<PrincipalCurvatures>& features);
private:
NeighborIndices nn_indices_;
DeviceArray2D<float> proj_normals_buf;
};
//////////////////////////////////////////////////////////////////////////////////////////////
///** \brief @b Class for Viewpoint Feature Histogramm estimation. */
class PCL_EXPORTS VFHEstimation : public FeatureFromNormals
{
public:
enum
{
BINS1_F1 = 45,
BINT2_F2 = 45,
BINS3_F3 = 45,
BINS4_F4 = 45,
BINS_VP = 128
};
VFHEstimation();
void setViewPoint(float vpx, float vpy, float vpz);
void getViewPoint(float& vpx, float& vpy, float& vpz) const;
void setUseGivenNormal (bool use);
void setNormalToUse (const NormalType& normal);
void setUseGivenCentroid (bool use);
void setCentroidToUse (const PointType& centroid);
void setNormalizeBins (bool normalize);
void setNormalizeDistance (bool normalize);
void setFillSizeComponent (bool fill_size);
void compute(DeviceArray<VFHSignature308>& feature);
private:
float vpx_, vpy_, vpz_;
bool use_given_normal_;
bool use_given_centroid_;
bool normalize_bins_;
bool normalize_distances_;
bool size_component_;
NormalType normal_to_use_;
PointType centroid_to_use_;
};
//////////////////////////////////////////////////////////////////////////////////////////////
///** \brief @b Class for SpinImages estimation. */
class PCL_EXPORTS SpinImageEstimation : public FeatureFromNormals
{
public:
using SpinImage = Histogram<153>;
SpinImageEstimation (unsigned int image_width = 8,
double support_angle_cos = 0.0, // when 0, this is bogus, so not applied
unsigned int min_pts_neighb = 0);
void setImageWidth (unsigned int bin_count);
void setSupportAngle (float support_angle_cos);
void setMinPointCountInNeighbourhood (unsigned int min_pts_neighb);
void setInputWithNormals (const PointCloud& input, const Normals& normals);
void setSearchSurfaceWithNormals (const PointCloud& surface, const Normals& normals);
void setRotationAxis (const NormalType& axis);
void setInputRotationAxes (const Normals& axes);
void useNormalsAsRotationAxis();
void setAngularDomain (bool is_angular = true);
void setRadialStructure (bool is_radial = true);
void compute(DeviceArray2D<SpinImage>& features, DeviceArray<unsigned char>& mask);
private:
Normals input_normals_;
Normals rotation_axes_cloud_;
bool is_angular_;
NormalType rotation_axis_;
bool use_custom_axis_;
/* use input normals as rotation axes*/
bool use_custom_axes_cloud_;
bool is_radial_;
unsigned int image_width_;
float support_angle_cos_;
unsigned int min_pts_neighb_;
bool fake_surface_;
NeighborIndices nn_indices_;
};
}
};
#endif /* _PCL_GPU_FEATURES_HPP_ */
pcl::gpu::DeviceArray2D
DeviceArray2D class
Definition device_array.h:188
pcl::gpu::DeviceArray< PointType >
pcl::gpu::FPFHEstimation
Class for FPFH estimation.
Definition features.hpp:142
pcl::gpu::FPFHEstimation::compute
void compute(const PointCloud &cloud, const Normals &normals, const NeighborIndices &neighbours, DeviceArray2D< FPFHSignature33 > &features)
pcl::gpu::FPFHEstimation::FPFHEstimation
FPFHEstimation()
pcl::gpu::FPFHEstimation::compute
void compute(DeviceArray2D< FPFHSignature33 > &features)
pcl::gpu::NormalEstimation
Class for normal estimation.
Definition features.hpp:94
pcl::gpu::NormalEstimation::NormalEstimation
NormalEstimation()
pcl::gpu::NormalEstimation::getViewPoint
void getViewPoint(float &vpx, float &vpy, float &vpz) const
pcl::gpu::NormalEstimation::computeNormals
static void computeNormals(const PointCloud &cloud, const NeighborIndices &nn_indices, Normals &normals)
pcl::gpu::NormalEstimation::flipNormalTowardsViewpoint
static void flipNormalTowardsViewpoint(const PointCloud &cloud, const Indices &indices, float vp_x, float vp_y, float vp_z, Normals &normals)
pcl::gpu::NormalEstimation::flipNormalTowardsViewpoint
static void flipNormalTowardsViewpoint(const PointCloud &cloud, float vp_x, float vp_y, float vp_z, Normals &normals)
pcl::gpu::NormalEstimation::setViewPoint
void setViewPoint(float vpx, float vpy, float vpz)
pcl::gpu::NormalEstimation::compute
void compute(Normals &normals)
pcl::gpu::Octree
Octree implementation on GPU.
Definition octree.hpp:59
pcl::gpu::PFHEstimation
Class for PFH estimation.
Definition features.hpp:115
pcl::gpu::PFHEstimation::compute
void compute(const PointCloud &cloud, const Normals &normals, const NeighborIndices &neighb_indices, DeviceArray2D< PFHSignature125 > &features)
pcl::gpu::PFHEstimation::compute
void compute(DeviceArray2D< PFHSignature125 > &features)
pcl::gpu::PFHRGBEstimation
Class for PFHRGB estimation.
Definition features.hpp:128
pcl::gpu::PFHRGBEstimation::compute
void compute(DeviceArray2D< PFHRGBSignature250 > &features)
pcl::gpu::PFHRGBEstimation::compute
void compute(const PointCloud &cloud, const Normals &normals, const NeighborIndices &neighb_indices, DeviceArray2D< PFHRGBSignature250 > &features)
pcl::gpu::PPFEstimation
**
Definition features.hpp:162
pcl::gpu::PPFEstimation::compute
void compute(DeviceArray< PPFSignature > &features)
pcl::gpu::PPFRGBEstimation
**
Definition features.hpp:171
pcl::gpu::PPFRGBEstimation::compute
void compute(DeviceArray< PPFRGBSignature > &features)
pcl::gpu::PPFRGBRegionEstimation
**
Definition features.hpp:182
pcl::gpu::PPFRGBRegionEstimation::compute
void compute(DeviceArray< PPFRGBSignature > &features)
pcl::gpu::PrincipalCurvaturesEstimation
‍**
Definition features.hpp:196
pcl::gpu::PrincipalCurvaturesEstimation::compute
void compute(DeviceArray< PrincipalCurvatures > &features)
pcl::gpu::SpinImageEstimation
‍**
Definition features.hpp:256
pcl::gpu::SpinImageEstimation::setImageWidth
void setImageWidth(unsigned int bin_count)
pcl::gpu::SpinImageEstimation::setMinPointCountInNeighbourhood
void setMinPointCountInNeighbourhood(unsigned int min_pts_neighb)
pcl::gpu::SpinImageEstimation::SpinImageEstimation
SpinImageEstimation(unsigned int image_width=8, double support_angle_cos=0.0, unsigned int min_pts_neighb=0)
pcl::gpu::SpinImageEstimation::compute
void compute(DeviceArray2D< SpinImage > &features, DeviceArray< unsigned char > &mask)
pcl::gpu::SpinImageEstimation::setSupportAngle
void setSupportAngle(float support_angle_cos)
pcl::gpu::SpinImageEstimation::SpinImage
Histogram< 153 > SpinImage
Definition features.hpp:258
pcl::gpu::SpinImageEstimation::setRadialStructure
void setRadialStructure(bool is_radial=true)
pcl::gpu::SpinImageEstimation::setSearchSurfaceWithNormals
void setSearchSurfaceWithNormals(const PointCloud &surface, const Normals &normals)
pcl::gpu::SpinImageEstimation::setAngularDomain
void setAngularDomain(bool is_angular=true)
pcl::gpu::SpinImageEstimation::setInputWithNormals
void setInputWithNormals(const PointCloud &input, const Normals &normals)
pcl::gpu::SpinImageEstimation::setRotationAxis
void setRotationAxis(const NormalType &axis)
pcl::gpu::SpinImageEstimation::setInputRotationAxes
void setInputRotationAxes(const Normals &axes)
pcl::gpu::SpinImageEstimation::useNormalsAsRotationAxis
void useNormalsAsRotationAxis()
pcl::gpu::VFHEstimation
**
Definition features.hpp:210
pcl::gpu::VFHEstimation::getViewPoint
void getViewPoint(float &vpx, float &vpy, float &vpz) const
pcl::gpu::VFHEstimation::setUseGivenNormal
void setUseGivenNormal(bool use)
pcl::gpu::VFHEstimation::setCentroidToUse
void setCentroidToUse(const PointType &centroid)
pcl::gpu::VFHEstimation::setNormalizeBins
void setNormalizeBins(bool normalize)
pcl::gpu::VFHEstimation::setNormalToUse
void setNormalToUse(const NormalType &normal)
pcl::gpu::VFHEstimation::VFHEstimation
VFHEstimation()
pcl::gpu::VFHEstimation::compute
void compute(DeviceArray< VFHSignature308 > &feature)
pcl::gpu::VFHEstimation::setNormalizeDistance
void setNormalizeDistance(bool normalize)
pcl::gpu::VFHEstimation::setUseGivenCentroid
void setUseGivenCentroid(bool use)
pcl::gpu::VFHEstimation::setViewPoint
void setViewPoint(float vpx, float vpy, float vpz)
pcl::gpu::VFHEstimation::setFillSizeComponent
void setFillSizeComponent(bool fill_size)
point_types.h
Defines all the PCL implemented PointT point type structures.
pcl
Definition convolution.h:46
pcl_macros.h
Defines all the PCL and non-PCL macros used.
pcl::Histogram
A point structure representing an N-D histogram.
Definition point_types.hpp:1599
pcl::PointXYZ
A point structure representing Euclidean xyz coordinates.
Definition point_types.hpp:322
pcl::gpu::FeatureFromNormals
Feature represents the base feature class that takes normals as input also.
Definition features.hpp:83
pcl::gpu::FeatureFromNormals::setInputNormals
void setInputNormals(const Normals &normals)
pcl::gpu::FeatureFromNormals::normals_
Normals normals_
Definition features.hpp:88
pcl::gpu::Feature
Feature represents the base feature class.
Definition features.hpp:54
pcl::gpu::Feature::cloud_
PointCloud cloud_
Definition features.hpp:70
pcl::gpu::Feature::setSearchSurface
void setSearchSurface(const PointCloud &surface)
pcl::gpu::Feature::indices_
Indices indices_
Definition features.hpp:72
pcl::gpu::Feature::setInputCloud
void setInputCloud(const PointCloud &cloud)
pcl::gpu::Feature::Feature
Feature()
pcl::gpu::Feature::radius_
float radius_
Definition features.hpp:73
pcl::gpu::Feature::octree_
Octree octree_
Definition features.hpp:76
pcl::gpu::Feature::setIndices
void setIndices(const Indices &indices)
pcl::gpu::Feature::max_results_
int max_results_
Definition features.hpp:74
pcl::gpu::Feature::setRadiusSearch
void setRadiusSearch(float radius, int max_results)
pcl::gpu::Feature::surface_
PointCloud surface_
Definition features.hpp:71
pcl::gpu::NeighborIndices
Definition device_format.hpp:47