40 #include <pcl/pcl_exports.h>
42 #include <pcl/cuda/common/eigen.h>
49 template <
template <
typename>
class Storage>
54 :
points_ (thrust::raw_pointer_cast(&input->points[0]))
56 ,
search_ (input, focallength, sqr_radius)
61 inline __host__ __device__
66 if (!isnan (query_pt.x))
70 return make_float4(query_pt.x);
76 return make_float4(0);
80 float curvature = evals.x / (query_pt.z * (0.2f / 4.0f) * query_pt.z * (0.2f / 4.0f));
82 float3 mc = normalize (evecs.
data[0]);
85 if ( dot (query_pt, mc) > 0 )
87 return make_float4 (mc.x, mc.y, mc.z, curvature);
97 template <
template <
typename>
class Storage>
104 inline __host__ __device__
107 float3 query_pt =
points_[idx];
108 if (isnan(query_pt.z))
109 return make_float4 (0.0f,0.0f,0.0f,0.0f);
115 bool west_valid = (xIdx > 1) && !isnan (
points_[idx-1].z) && std::abs (
points_[idx-1].z - query_pt.
z) < 200;
116 bool east_valid = (xIdx <
width_-1) && !isnan (
points_[idx+1].z) && std::abs (
points_[idx+1].z - query_pt.
z) < 200;
121 if (west_valid & east_valid)
123 if (west_valid & !east_valid)
125 if (!west_valid & east_valid)
127 if (!west_valid & !east_valid)
128 return make_float4 (0.0f,0.0f,0.0f,1.0f);
130 if (south_valid & north_valid)
132 if (south_valid & !north_valid)
134 if (!south_valid & north_valid)
136 if (!south_valid & !north_valid)
137 return make_float4 (0.0f,0.0f,0.0f,1.0f);
139 float3 normal = cross (horiz, vert);
141 float curvature = length (normal);
142 curvature = std::abs(horiz.z) > 0.04 | std::abs(vert.z) > 0.04 | !west_valid | !east_valid | !north_valid | !south_valid;
144 float3 mc = normalize (normal);
145 if ( dot (query_pt, mc) > 0 )
147 return make_float4 (mc.x, mc.y, mc.z, curvature);
155 template <
template <
typename>
class Storage>
160 :
points_ (thrust::raw_pointer_cast(&input->points[0]))
162 ,
search_ (input, focallength, sqr_radius)
167 template <
typename Tuple>
168 inline __host__ __device__
171 float3 query_pt = thrust::get<0>(t);
172 float4 normal = thrust::get<1>(t);
175 if (!isnan (query_pt.x))
178 return make_float4(query_pt.x);
180 float proj = normal.x * (query_pt.x - centroid.x) / sqrt(
sqr_radius_) +
181 normal.y * (query_pt.y - centroid.y) / sqrt(
sqr_radius_) +
182 normal.z * (query_pt.z - centroid.z) / sqrt(
sqr_radius_) ;
__host__ __device__ float3 computeCentroid(const float3 &query_pt, CovarianceMatrix &cov, float sqrt_desired_nr_neighbors)
__host__ __device__ int computeCovarianceOnline(const float3 &query_pt, CovarianceMatrix &cov, float sqrt_desired_nr_neighbors)
shared_ptr< const PointCloudAOS< Storage > > ConstPtr
__host__ __device__ void eigen33(const CovarianceMatrix &mat, CovarianceMatrix &evecs, float3 &evals)
misnamed class holding a 3x3 matrix
__host__ __device__ float4 operator()(int idx)
const PointXYZRGB * points_
FastNormalEstimationKernel(const typename PointCloudAOS< Storage >::ConstPtr &input, int width, int height)
OrganizedRadiusSearch< CloudConstPtr > search_
typename PointCloudAOS< Storage >::ConstPtr CloudConstPtr
__host__ __device__ float4 operator()(const Tuple &t)
float sqrt_desired_nr_neighbors_
const PointXYZRGB * points_
NormalDeviationKernel(const typename PointCloudAOS< Storage >::ConstPtr &input, float focallength, float sqr_radius, float sqrt_desired_nr_neighbors)
OrganizedRadiusSearch< CloudConstPtr > search_
NormalEstimationKernel(const typename PointCloudAOS< Storage >::ConstPtr &input, float focallength, float sqr_radius, float sqrt_desired_nr_neighbors)
float sqrt_desired_nr_neighbors_
__host__ __device__ float4 operator()(float3 query_pt)
const PointXYZRGB * points_
typename PointCloudAOS< Storage >::ConstPtr CloudConstPtr
Default point xyz-rgb structure.