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
00085
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)
00094 b_ctr++;
00095 }
00096
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
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
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__