fast_edge_estimation_3d.hpp
Go to the documentation of this file.
00001 
00063 #ifndef __IMPL_FAST_EDGE_ESTIMATION_3D_H__
00064 #define __IMPL_FAST_EDGE_ESTIMATION_3D_H__
00065 
00066 #include "cob_3d_features/fast_edge_estimation_3d.h"
00067 
00068 template <typename PointInT, typename PointNT, typename PointOutT> void
00069 cob_3d_features::FastEdgeEstimation3D<PointInT, PointNT, PointOutT>::isEdgePoint (
00070     const pcl::PointCloud<PointInT> &cloud,
00071     const PointInT &q_point,
00072     const std::vector<int> &indices,
00073     const Eigen::Vector3f &n,
00074     float &strength)
00075 {
00076   if (indices.size () < 3)
00077   {
00078     strength = 0.0;
00079     return;
00080   }
00081   float nd_dot;
00082   Eigen::Vector3f delta;
00083   Eigen::Vector3f q = q_point.getVector3fMap();
00084   // Compute the angles between each neighboring point and the query point itself
00085   //int nn_ctr=0;//, nan_ctr=0;
00086   int b_ctr=0;
00087   float dist_threshold = 0.0015544 * pixel_search_radius_ * q.norm();
00088 
00089   for (std::vector<int>::const_iterator it = indices.begin(); it != indices.end(); ++it)
00090   {
00091     delta = cloud.points[*it].getVector3fMap() - q;
00092     nd_dot = n.dot (delta);
00093     if(fabs(nd_dot) > dist_threshold) //is border point
00094       b_ctr++;
00095   }
00096   //std::cout << dist_threshold << "\t" << indices.size() << "\t" << b_ctr << std::endl;
00097   strength = (float)b_ctr/indices.size();
00098   return;
00099 }
00100 
00101 template <typename PointInT, typename PointNT, typename PointOutT> void
00102 cob_3d_features::FastEdgeEstimation3D<PointInT, PointNT, PointOutT>::computeFeature (
00103   PointCloudOut &output)
00104 {
00105   std::vector<int> nn_indices;
00106   Eigen::Vector3f normal;
00107 
00108   // Iterating over the entire index vector
00109   for (std::vector<int>::iterator it = indices_->begin(); it != indices_->end(); ++it)
00110   {
00111     if (isnan(normals_->points[*it].normal[0]))
00112       output.points[*it].strength=2;
00113     else
00114     {
00115       this->searchForNeighbors (*it, nn_indices);
00116 
00117       normal[0] = normals_->points[*it].normal_x;
00118       normal[1] = normals_->points[*it].normal_y;
00119       normal[2] = normals_->points[*it].normal_z;
00120       // Estimate whether the point is lying on a boundary surface or not
00121       isEdgePoint (*surface_, input_->points[*it], nn_indices,
00122                    normal, output.points[*it].strength);
00123     }
00124   }
00125 }
00126 
00127 #define PCL_INSTANTIATE_FastEdgeEstimation3D(PointInT,PointNT,PointOutT) template class PCL_EXPORTS cob_3d_features::FastEdgeEstimation3D<PointInT, PointNT, PointOutT>;
00128 
00129 #endif    // __IMPL_FAST_EDGE_ESTIMATION_3D_H__


cob_3d_features
Author(s): Georg Arbeiter
autogenerated on Wed Aug 26 2015 11:02:26