41 #ifndef PCL_FEATURES_IMPL_NORMAL_3D_OMP_H_ 42 #define PCL_FEATURES_IMPL_NORMAL_3D_OMP_H_ 44 #include <pcl/features/normal_3d_omp.h> 47 template <
typename Po
intInT,
typename Po
intOutT>
void 52 threads_ = omp_get_num_procs();
57 threads_ = nr_threads;
61 template <
typename Po
intInT,
typename Po
intOutT>
void 66 std::vector<int> nn_indices (k_);
67 std::vector<float> nn_dists (k_);
69 output.is_dense =
true;
74 #pragma omp parallel for shared (output) private (nn_indices, nn_dists) num_threads(threads_) 77 for (
int idx = 0; idx < static_cast<int> (indices_->size ()); ++idx)
80 if (this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists) == 0 ||
83 output.points[idx].normal[0] = output.points[idx].normal[1] = output.points[idx].normal[2] = output.points[idx].curvature = std::numeric_limits<float>::quiet_NaN ();
85 output.is_dense =
false;
89 output.points[idx].normal_x = n[0];
90 output.points[idx].normal_y = n[1];
91 output.points[idx].normal_z = n[2];
94 output.points[idx].normal[0], output.points[idx].normal[1], output.points[idx].normal[2]);
101 #pragma omp parallel for shared (output) private (nn_indices, nn_dists) num_threads(threads_) 104 for (
int idx = 0; idx < static_cast<int> (indices_->size ()); ++idx)
107 if (!isFinite ((*input_)[(*indices_)[idx]]) ||
108 this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists) == 0 ||
111 output.points[idx].normal[0] = output.points[idx].normal[1] = output.points[idx].normal[2] = output.points[idx].curvature = std::numeric_limits<float>::quiet_NaN ();
113 output.is_dense =
false;
117 output.points[idx].normal_x = n[0];
118 output.points[idx].normal_y = n[1];
119 output.points[idx].normal_z = n[2];
122 output.points[idx].normal[0], output.points[idx].normal[1], output.points[idx].normal[2]);
128 #define PCL_INSTANTIATE_NormalEstimationOMP(T,NT) template class PCL_EXPORTS pcl::NormalEstimationOMP<T,NT>; 130 #endif // PCL_FEATURES_IMPL_NORMAL_3D_OMP_H_ NormalEstimationOMP estimates local surface properties at each 3D point, such as surface normals and ...
bool computePointNormal(const pcl::PointCloud< PointT > &cloud, Eigen::Vector4f &plane_parameters, float &curvature)
Compute the Least-Squares plane fit for a given set of points, and return the estimated plane paramet...
void flipNormalTowardsViewpoint(const PointT &point, float vp_x, float vp_y, float vp_z, Eigen::Matrix< Scalar, 4, 1 > &normal)
Flip (in place) the estimated normal of a point towards a given viewpoint.
void setNumberOfThreads(unsigned int nr_threads=0)
Initialize the scheduler and set the number of threads to use.