Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #ifndef PCL_FEATURES_IMPL_NORMAL_3D_OMP_H_
00042 #define PCL_FEATURES_IMPL_NORMAL_3D_OMP_H_
00043
00044 #include <pcl/features/normal_3d_omp.h>
00045
00047 template <typename PointInT, typename PointOutT> void
00048 pcl::NormalEstimationOMP<PointInT, PointOutT>::computeFeature (PointCloudOut &output)
00049 {
00050
00051
00052 std::vector<int> nn_indices (k_);
00053 std::vector<float> nn_dists (k_);
00054
00055 output.is_dense = true;
00056
00057
00058 if (input_->is_dense)
00059 {
00060 #ifdef _OPENMP
00061 #pragma omp parallel for shared (output) private (nn_indices, nn_dists) num_threads(threads_)
00062 #endif
00063
00064 for (int idx = 0; idx < static_cast<int> (indices_->size ()); ++idx)
00065 {
00066 if (this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists) == 0)
00067 {
00068 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 ();
00069
00070 output.is_dense = false;
00071 continue;
00072 }
00073
00074 Eigen::Vector4f n;
00075 pcl::computePointNormal<PointInT> (*surface_, nn_indices,
00076 n,
00077 output.points[idx].curvature);
00078
00079 output.points[idx].normal_x = n[0];
00080 output.points[idx].normal_y = n[1];
00081 output.points[idx].normal_z = n[2];
00082
00083 flipNormalTowardsViewpoint (input_->points[(*indices_)[idx]], vpx_, vpy_, vpz_,
00084 output.points[idx].normal[0],
00085 output.points[idx].normal[1],
00086 output.points[idx].normal[2]);
00087 }
00088 }
00089 else
00090 {
00091 #ifdef _OPENMP
00092 #pragma omp parallel for shared (output) private (nn_indices, nn_dists) num_threads(threads_)
00093 #endif
00094
00095 for (int idx = 0; idx < static_cast<int> (indices_->size ()); ++idx)
00096 {
00097 if (!isFinite ((*input_)[(*indices_)[idx]]) ||
00098 this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists) == 0)
00099 {
00100 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 ();
00101
00102 output.is_dense = false;
00103 continue;
00104 }
00105
00106 Eigen::Vector4f n;
00107 pcl::computePointNormal<PointInT> (*surface_, nn_indices,
00108 n,
00109 output.points[idx].curvature);
00110
00111 output.points[idx].normal_x = n[0];
00112 output.points[idx].normal_y = n[1];
00113 output.points[idx].normal_z = n[2];
00114
00115 flipNormalTowardsViewpoint (input_->points[(*indices_)[idx]], vpx_, vpy_, vpz_,
00116 output.points[idx].normal[0], output.points[idx].normal[1], output.points[idx].normal[2]);
00117 }
00118 }
00119 }
00120
00121 #define PCL_INSTANTIATE_NormalEstimationOMP(T,NT) template class PCL_EXPORTS pcl::NormalEstimationOMP<T,NT>;
00122
00123 #endif // PCL_FEATURES_IMPL_NORMAL_3D_OMP_H_
00124