41 #ifndef PCL_FEATURES_IMPL_BOUNDARY_H_ 42 #define PCL_FEATURES_IMPL_BOUNDARY_H_ 44 #include <pcl/features/boundary.h> 48 template <
typename Po
intInT,
typename Po
intNT,
typename Po
intOutT>
bool 51 const std::vector<int> &indices,
52 const Eigen::Vector4f &u,
const Eigen::Vector4f &v,
53 const float angle_threshold)
55 return (isBoundaryPoint (cloud, cloud.
points[q_idx], indices, u, v, angle_threshold));
59 template <
typename Po
intInT,
typename Po
intNT,
typename Po
intOutT>
bool 62 const std::vector<int> &indices,
63 const Eigen::Vector4f &u,
const Eigen::Vector4f &v,
64 const float angle_threshold)
66 if (indices.size () < 3)
69 if (!pcl_isfinite (q_point.x) || !pcl_isfinite (q_point.y) || !pcl_isfinite (q_point.z))
73 std::vector<float> angles (indices.size ());
74 float max_dif = FLT_MIN, dif;
77 for (
size_t i = 0; i < indices.size (); ++i)
79 if (!pcl_isfinite (cloud.
points[indices[i]].x) ||
80 !pcl_isfinite (cloud.
points[indices[i]].y) ||
81 !pcl_isfinite (cloud.
points[indices[i]].z))
84 Eigen::Vector4f delta = cloud.
points[indices[i]].getVector4fMap () - q_point.getVector4fMap ();
85 if (delta == Eigen::Vector4f::Zero())
88 angles[cp++] = atan2f (v.dot (delta), u.dot (delta));
94 std::sort (angles.begin (), angles.end ());
97 for (
size_t i = 0; i < angles.size () - 1; ++i)
99 dif = angles[i + 1] - angles[i];
104 dif = 2 *
static_cast<float> (M_PI) - angles[angles.size () - 1] + angles[0];
109 if (max_dif > angle_threshold)
116 template <
typename Po
intInT,
typename Po
intNT,
typename Po
intOutT>
void 121 std::vector<int> nn_indices (k_);
122 std::vector<float> nn_dists (k_);
124 Eigen::Vector4f u = Eigen::Vector4f::Zero (), v = Eigen::Vector4f::Zero ();
128 if (input_->is_dense)
131 for (
size_t idx = 0; idx < indices_->size (); ++idx)
133 if (this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists) == 0)
135 output.
points[idx].boundary_point = std::numeric_limits<uint8_t>::quiet_NaN ();
143 getCoordinateSystemOnPlane (normals_->points[(*indices_)[idx]], u, v);
146 output.
points[idx].boundary_point = isBoundaryPoint (*surface_, input_->points[(*indices_)[idx]], nn_indices, u, v, angle_threshold_);
152 for (
size_t idx = 0; idx < indices_->size (); ++idx)
154 if (!
isFinite ((*input_)[(*indices_)[idx]]) ||
155 this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists) == 0)
157 output.
points[idx].boundary_point = std::numeric_limits<uint8_t>::quiet_NaN ();
165 getCoordinateSystemOnPlane (normals_->points[(*indices_)[idx]], u, v);
168 output.
points[idx].boundary_point = isBoundaryPoint (*surface_, input_->points[(*indices_)[idx]], nn_indices, u, v, angle_threshold_);
173 #define PCL_INSTANTIATE_BoundaryEstimation(PointInT,PointNT,PointOutT) template class PCL_EXPORTS pcl::BoundaryEstimation<PointInT, PointNT, PointOutT>; 175 #endif // PCL_FEATURES_IMPL_BOUNDARY_H_ bool isFinite(const PointT &pt)
Tests if the 3D components of a point are all finite param[in] pt point to be tested return true if f...
void computeFeature(PointCloudOut &output)
Estimate whether a set of points is lying on surface boundaries using an angle criterion for all poin...
std::vector< PointT, Eigen::aligned_allocator< PointT > > points
The point data.
bool isBoundaryPoint(const pcl::PointCloud< PointInT > &cloud, int q_idx, const std::vector< int > &indices, const Eigen::Vector4f &u, const Eigen::Vector4f &v, const float angle_threshold)
Check whether a point is a boundary point in a planar patch of projected points given by indices...
bool is_dense
True if no points are invalid (e.g., have NaN or Inf values in any of their floating point fields)...