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 #ifndef PCL_FEATURES_IMPL_FPFH_OMP_H_
00039 #define PCL_FEATURES_IMPL_FPFH_OMP_H_
00040
00041 #include "pcl/features/fpfh_omp.h"
00042
00044 template <typename PointInT, typename PointNT, typename PointOutT> void
00045 pcl::FPFHEstimationOMP<PointInT, PointNT, PointOutT>::computeFeature (PointCloudOut &output)
00046 {
00047
00048 if (!normals_)
00049 {
00050 ROS_ERROR ("[pcl::%s::computeFeature] No input dataset containing normals was given!", getClassName ().c_str ());
00051 output.width = output.height = 0;
00052 output.points.clear ();
00053 return;
00054 }
00055 if (normals_->points.size () != surface_->points.size ())
00056 {
00057 ROS_ERROR ("[pcl::%s::computeFeature] The number of points in the input dataset differs from the number of points in the dataset containing the normals!", getClassName ().c_str ());
00058 output.width = output.height = 0;
00059 output.points.clear ();
00060 return;
00061 }
00062
00063 int data_size = indices_->size ();
00064
00065 hist_f1_.setZero (data_size, nr_bins_f1_);
00066 hist_f2_.setZero (data_size, nr_bins_f2_);
00067 hist_f3_.setZero (data_size, nr_bins_f3_);
00068
00069 int nr_bins = nr_bins_f1_ + nr_bins_f2_ + nr_bins_f3_;
00070
00071
00072 #pragma omp parallel for schedule (dynamic, threads_)
00073 for (int idx = 0; idx < data_size; ++idx)
00074 {
00075
00076
00077 std::vector<int> nn_indices (k_);
00078 std::vector<float> nn_dists (k_);
00079
00080 searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists);
00081
00082
00083 computePointSPFHSignature (*surface_, *normals_, (*indices_)[idx], nn_indices,
00084 hist_f1_, hist_f2_, hist_f3_);
00085 }
00086
00087
00088 #pragma omp parallel for schedule (dynamic, threads_)
00089 for (int idx = 0; idx < data_size; ++idx)
00090 {
00091
00092
00093 std::vector<int> nn_indices (k_);
00094 std::vector<float> nn_dists (k_);
00095
00096 Eigen::VectorXf fpfh_histogram = Eigen::VectorXf::Zero (nr_bins);
00097
00098 searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists);
00099
00100 weightPointSPFHSignature (hist_f1_, hist_f2_, hist_f3_, nn_indices, nn_dists, fpfh_histogram);
00101
00102
00103 for (int d = 0; d < fpfh_histogram.size (); ++d)
00104 output.points[idx].histogram[d] = fpfh_histogram[d];
00105 }
00106 }
00107
00108 #define PCL_INSTANTIATE_FPFHEstimationOMP(T,NT,OutT) template class pcl::FPFHEstimationOMP<T,NT,OutT>;
00109
00110 #endif // PCL_FEATURES_IMPL_FPFH_OMP_H_
00111