Loading...
Searching...
No Matches
internal.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_INTERNAL_HPP_
#define PCL_GPU_FEATURES_INTERNAL_HPP_
#include <pcl/gpu/containers/device_array.h>
#include <pcl/gpu/octree/device_format.hpp>
#include <cuda_runtime.h>
#undef PI
#ifndef PI
#define PI 3.1415926535897931f
#endif
namespace pcl
{
namespace device
{
using pcl::gpu::DeviceArray;
using pcl::gpu::DeviceArray2D;
using pcl::gpu::NeighborIndices;
using PointType = float4;
using NormalType = float4;
using PointXYZRGB = float4;
using PointCloud = DeviceArray<PointType>;
using Normals = DeviceArray<NormalType>;
using Indices = DeviceArray<int>;
using PointXYZRGBCloud = DeviceArray<PointType>;
template <int N> struct Histogram
{
float histogram[N];
};
using PFHSignature125 = Histogram<125>;
using PFHRGBSignature250 = Histogram<250>;
using FPFHSignature33 = Histogram<33>;
using VFHSignature308 = Histogram<308>;
struct PPFSignature
{
float f1, f2, f3, f4;
float alpha_m;
};
struct PPFRGBSignature
{
float f1, f2, f3, f4;
float r_ratio, g_ratio, b_ratio;
float alpha_m;
};
struct PrincipalCurvatures
{
union
{
float principal_curvature[3];
struct
{
float principal_curvature_x;
float principal_curvature_y;
float principal_curvature_z;
};
};
float pc1;
float pc2;
};
// normals estimation
void computeNormals(const PointCloud& cloud, const NeighborIndices& nn_indices, Normals& normals);
void flipNormalTowardsViewpoint(const PointCloud& cloud, const float3& vp, Normals& normals);
void flipNormalTowardsViewpoint(const PointCloud& cloud, const Indices& indices, const float3& vp, Normals& normals);
// pfh estimation
void repackToAosForPfh(const PointCloud& cloud, const Normals& normals, const NeighborIndices& neighbours, DeviceArray2D<float>& data_rpk, int& max_elems_rpk);
void computePfh125(const DeviceArray2D<float>& data_rpk, int max_elems_rpk, const NeighborIndices& neighbours, DeviceArray2D<PFHSignature125>& features);
void repackToAosForPfhRgb(const PointCloud& cloud, const Normals& normals, const NeighborIndices& neighbours, DeviceArray2D<float>& data_rpk, int& max_elems_rpk);
void computePfhRgb250(const DeviceArray2D<float>& data_rpk, int max_elems_rpk, const NeighborIndices& neighbours, DeviceArray2D<PFHRGBSignature250>& features);
// fpfh estimation
void computeSPFH(const PointCloud& surface, const Normals& normals, const Indices& indices, const NeighborIndices& neighbours, DeviceArray2D<FPFHSignature33>& spfh33);
void computeFPFH(const PointCloud& cloud, const NeighborIndices& neighbours, const DeviceArray2D<FPFHSignature33>& spfh, DeviceArray2D<FPFHSignature33>& features);
void computeFPFH(const PointCloud& cloud, const Indices& indices, const PointCloud& surface,
const NeighborIndices& neighbours, DeviceArray<int>& lookup, const DeviceArray2D<FPFHSignature33>& spfh, DeviceArray2D<FPFHSignature33>& features);
int computeUniqueIndices(std::size_t surface_size, const NeighborIndices& neighbours, DeviceArray<int>& unique_indices, DeviceArray<int>& lookup);
// ppf estimation
void computePPF(const PointCloud& input, const Normals& normals, const Indices& indices, DeviceArray<PPFSignature>& output);
void computePPFRGB(const PointXYZRGBCloud& input, const Normals& normals, const Indices& indices, DeviceArray<PPFRGBSignature>& output);
void computePPFRGBRegion(const PointXYZRGBCloud& cloud, const Normals& normals, const Indices& indices,
const NeighborIndices& nn_indices, DeviceArray<PPFRGBSignature>& output);
//PrincipalCurvatures estimation
void computePointPrincipalCurvatures(const Normals& normals, const Indices& indices, const NeighborIndices& neighbours,
DeviceArray<PrincipalCurvatures>& output, DeviceArray2D<float>& proj_normals_buf);
//vfh estimation
template<typename PointT> void compute3DCentroid(const DeviceArray<PointT>& cloud, float3& centroid);
template<typename PointT> void compute3DCentroid(const DeviceArray<PointT>& cloud, const Indices& indices, float3& centroid);
template<typename PointT> float3 getMaxDistance(const DeviceArray<PointT>& cloud, const float3& pivot);
template<typename PointT> float3 getMaxDistance(const DeviceArray<PointT>& cloud, const Indices& indices, const float3& pivot);
struct VFHEstimationImpl
{
float3 xyz_centroid;
float3 normal_centroid;
float3 viewpoint;
Indices indices;
PointCloud points;
Normals normals;
bool normalize_distances;
bool size_component;
bool normalize_bins;
void compute(DeviceArray<VFHSignature308>& feature);
};
//spinimages estimation
void computeSpinImagesOrigigNormal(bool radial, bool angular, float support_angle_cos, const Indices& indices, const PointCloud& input_cloud, const Normals& input_normals,
const PointCloud& surface, const Normals& normals, const NeighborIndices& neighbours, int min_neighb, int image_width, float bin_size, PtrStep<float> output);
void computeSpinImagesCustomAxes(bool radial, bool angular, float support_angle_cos, const Indices& indices, const PointCloud& input_cloud, const Normals& input_normals,
const PointCloud& surface, const Normals& normals, const NeighborIndices& neighbours, int min_neighb, int image_width, float bin_size, const float3& rotation_axis, PtrStep<float> output);
void computeSpinImagesCustomAxesCloud(bool radial, bool angular, float support_angle_cos, const Indices& indices, const PointCloud& input_cloud, const Normals& input_normals,
const PointCloud& surface, const Normals& normals, const NeighborIndices& neighbours, int min_neighb, int image_width, float bin_size, const Normals& rotation_axes_cloud, PtrStep<float> output);
void computeMask(const NeighborIndices& neighbours, int min_neighb, DeviceArray<unsigned char>& mask);
}
}
#endif /* PCL_GPU_FEATURES_INTERNAL_HPP_ */
pcl::gpu::DeviceArray2D
DeviceArray2D class
Definition device_array.h:188
pcl::gpu::DeviceArray
DeviceArray class
Definition device_array.h:54
pcl::device::computePfhRgb250
void computePfhRgb250(const DeviceArray2D< float > &data_rpk, int max_elems_rpk, const NeighborIndices &neighbours, DeviceArray2D< PFHRGBSignature250 > &features)
pcl::device::computeSPFH
void computeSPFH(const PointCloud &surface, const Normals &normals, const Indices &indices, const NeighborIndices &neighbours, DeviceArray2D< FPFHSignature33 > &spfh33)
pcl::device::computeFPFH
void computeFPFH(const PointCloud &cloud, const NeighborIndices &neighbours, const DeviceArray2D< FPFHSignature33 > &spfh, DeviceArray2D< FPFHSignature33 > &features)
pcl::device::computeSpinImagesCustomAxesCloud
void computeSpinImagesCustomAxesCloud(bool radial, bool angular, float support_angle_cos, const Indices &indices, const PointCloud &input_cloud, const Normals &input_normals, const PointCloud &surface, const Normals &normals, const NeighborIndices &neighbours, int min_neighb, int image_width, float bin_size, const Normals &rotation_axes_cloud, PtrStep< float > output)
pcl::device::computePointPrincipalCurvatures
void computePointPrincipalCurvatures(const Normals &normals, const Indices &indices, const NeighborIndices &neighbours, DeviceArray< PrincipalCurvatures > &output, DeviceArray2D< float > &proj_normals_buf)
pcl::device::computePPFRGBRegion
void computePPFRGBRegion(const PointXYZRGBCloud &cloud, const Normals &normals, const Indices &indices, const NeighborIndices &nn_indices, DeviceArray< PPFRGBSignature > &output)
pcl::device::flipNormalTowardsViewpoint
void flipNormalTowardsViewpoint(const PointCloud &cloud, const float3 &vp, Normals &normals)
pcl::device::computePfh125
void computePfh125(const DeviceArray2D< float > &data_rpk, int max_elems_rpk, const NeighborIndices &neighbours, DeviceArray2D< PFHSignature125 > &features)
pcl::device::PFHRGBSignature250
Histogram< 250 > PFHRGBSignature250
Definition internal.hpp:74
pcl::device::PointType
float4 PointType
Definition internal.hpp:58
pcl::device::VFHSignature308
Histogram< 308 > VFHSignature308
Definition internal.hpp:76
pcl::device::computeUniqueIndices
int computeUniqueIndices(std::size_t surface_size, const NeighborIndices &neighbours, DeviceArray< int > &unique_indices, DeviceArray< int > &lookup)
pcl::device::FPFHSignature33
Histogram< 33 > FPFHSignature33
Definition internal.hpp:75
pcl::device::repackToAosForPfhRgb
void repackToAosForPfhRgb(const PointCloud &cloud, const Normals &normals, const NeighborIndices &neighbours, DeviceArray2D< float > &data_rpk, int &max_elems_rpk)
pcl::device::repackToAosForPfh
void repackToAosForPfh(const PointCloud &cloud, const Normals &normals, const NeighborIndices &neighbours, DeviceArray2D< float > &data_rpk, int &max_elems_rpk)
pcl::device::compute3DCentroid
void compute3DCentroid(const DeviceArray< PointT > &cloud, float3 &centroid)
pcl::device::computeMask
void computeMask(const NeighborIndices &neighbours, int min_neighb, DeviceArray< unsigned char > &mask)
pcl::device::computeNormals
void computeNormals(const PointCloud &cloud, const NeighborIndices &nn_indices, Normals &normals)
pcl::device::getMaxDistance
float3 getMaxDistance(const DeviceArray< PointT > &cloud, const float3 &pivot)
pcl::device::PFHSignature125
Histogram< 125 > PFHSignature125
Definition internal.hpp:73
pcl::device::PointXYZRGB
float4 PointXYZRGB
Definition internal.hpp:60
pcl::device::NormalType
float4 NormalType
Definition internal.hpp:59
pcl::device::computeSpinImagesCustomAxes
void computeSpinImagesCustomAxes(bool radial, bool angular, float support_angle_cos, const Indices &indices, const PointCloud &input_cloud, const Normals &input_normals, const PointCloud &surface, const Normals &normals, const NeighborIndices &neighbours, int min_neighb, int image_width, float bin_size, const float3 &rotation_axis, PtrStep< float > output)
pcl::device::computeSpinImagesOrigigNormal
void computeSpinImagesOrigigNormal(bool radial, bool angular, float support_angle_cos, const Indices &indices, const PointCloud &input_cloud, const Normals &input_normals, const PointCloud &surface, const Normals &normals, const NeighborIndices &neighbours, int min_neighb, int image_width, float bin_size, PtrStep< float > output)
pcl::device::computePPF
void computePPF(const PointCloud &input, const Normals &normals, const Indices &indices, DeviceArray< PPFSignature > &output)
pcl::device::computePPFRGB
void computePPFRGB(const PointXYZRGBCloud &input, const Normals &normals, const Indices &indices, DeviceArray< PPFRGBSignature > &output)
pcl
Definition convolution.h:46
pcl::device::Histogram
Definition internal.hpp:69
pcl::device::Histogram::histogram
float histogram[N]
Definition internal.hpp:70
pcl::device::PPFRGBSignature
Definition internal.hpp:85
pcl::device::PPFRGBSignature::f3
float f3
Definition internal.hpp:86
pcl::device::PPFRGBSignature::f1
float f1
Definition internal.hpp:86
pcl::device::PPFRGBSignature::b_ratio
float b_ratio
Definition internal.hpp:87
pcl::device::PPFRGBSignature::f2
float f2
Definition internal.hpp:86
pcl::device::PPFRGBSignature::f4
float f4
Definition internal.hpp:86
pcl::device::PPFRGBSignature::alpha_m
float alpha_m
Definition internal.hpp:88
pcl::device::PPFRGBSignature::r_ratio
float r_ratio
Definition internal.hpp:87
pcl::device::PPFRGBSignature::g_ratio
float g_ratio
Definition internal.hpp:87
pcl::device::PPFSignature
Definition internal.hpp:79
pcl::device::PPFSignature::f2
float f2
Definition internal.hpp:80
pcl::device::PPFSignature::alpha_m
float alpha_m
Definition internal.hpp:81
pcl::device::PPFSignature::f3
float f3
Definition internal.hpp:80
pcl::device::PPFSignature::f1
float f1
Definition internal.hpp:80
pcl::device::PPFSignature::f4
float f4
Definition internal.hpp:80
pcl::device::PrincipalCurvatures
Definition internal.hpp:92
pcl::device::PrincipalCurvatures::principal_curvature_y
float principal_curvature_y
Definition internal.hpp:99
pcl::device::PrincipalCurvatures::principal_curvature_z
float principal_curvature_z
Definition internal.hpp:100
pcl::device::PrincipalCurvatures::principal_curvature
float principal_curvature[3]
Definition internal.hpp:95
pcl::device::PrincipalCurvatures::pc1
float pc1
Definition internal.hpp:103
pcl::device::PrincipalCurvatures::principal_curvature_x
float principal_curvature_x
Definition internal.hpp:98
pcl::device::PrincipalCurvatures::pc2
float pc2
Definition internal.hpp:104
pcl::device::VFHEstimationImpl
Definition internal.hpp:148
pcl::device::VFHEstimationImpl::viewpoint
float3 viewpoint
Definition internal.hpp:151
pcl::device::VFHEstimationImpl::normalize_distances
bool normalize_distances
Definition internal.hpp:157
pcl::device::VFHEstimationImpl::compute
void compute(DeviceArray< VFHSignature308 > &feature)
pcl::device::VFHEstimationImpl::indices
Indices indices
Definition internal.hpp:153
pcl::device::VFHEstimationImpl::points
PointCloud points
Definition internal.hpp:154
pcl::device::VFHEstimationImpl::normalize_bins
bool normalize_bins
Definition internal.hpp:159
pcl::device::VFHEstimationImpl::xyz_centroid
float3 xyz_centroid
Definition internal.hpp:149
pcl::device::VFHEstimationImpl::size_component
bool size_component
Definition internal.hpp:158
pcl::device::VFHEstimationImpl::normals
Normals normals
Definition internal.hpp:155
pcl::device::VFHEstimationImpl::normal_centroid
float3 normal_centroid
Definition internal.hpp:150
pcl::gpu::NeighborIndices
Definition device_format.hpp:47
pcl::gpu::PtrStep
Definition kernel_containers.h:85