43#include <pcl/features/boundary.h>
44#include <pcl/common/point_tests.h>
50template <
typename Po
intInT,
typename Po
intNT,
typename Po
intOutT>
bool
54 const Eigen::Vector4f &u,
const Eigen::Vector4f &v,
55 const float angle_threshold)
57 return (
isBoundaryPoint (cloud, cloud[q_idx], indices, u, v, angle_threshold));
61template <
typename Po
intInT,
typename Po
intNT,
typename Po
intOutT>
bool
65 const Eigen::Vector4f &u,
const Eigen::Vector4f &v,
66 const float angle_threshold)
68 if (indices.size () < 3)
71 if (!std::isfinite (q_point.x) || !std::isfinite (q_point.y) || !std::isfinite (q_point.z))
75 std::vector<float> angles (indices.size ());
76 float max_dif = 0, dif;
79 for (
const auto &index : indices)
81 if (!std::isfinite (cloud[index].x) ||
82 !std::isfinite (cloud[index].y) ||
83 !std::isfinite (cloud[index].z))
86 Eigen::Vector4f delta = cloud[index].getVector4fMap () - q_point.getVector4fMap ();
87 if (delta == Eigen::Vector4f::Zero())
90 angles[cp++] = std::atan2 (v.dot (delta), u.dot (delta));
96 std::sort (angles.begin (), angles.end ());
99 for (std::size_t i = 0; i < angles.size () - 1; ++i)
101 dif = angles[i + 1] - angles[i];
106 dif = 2 *
static_cast<float> (
M_PI) - angles[angles.size () - 1] + angles[0];
111 return (max_dif > angle_threshold);
115template <
typename Po
intInT,
typename Po
intNT,
typename Po
intOutT>
void
121 std::vector<float> nn_dists (
k_);
123 Eigen::Vector4f u = Eigen::Vector4f::Zero (), v = Eigen::Vector4f::Zero ();
125 output.is_dense =
true;
130 for (std::size_t idx = 0; idx <
indices_->size (); ++idx)
134 output[idx].boundary_point = std::numeric_limits<std::uint8_t>::quiet_NaN ();
135 output.is_dense =
false;
151 for (std::size_t idx = 0; idx <
indices_->size (); ++idx)
156 output[idx].boundary_point = std::numeric_limits<std::uint8_t>::quiet_NaN ();
157 output.is_dense =
false;
172#define PCL_INSTANTIATE_BoundaryEstimation(PointInT,PointNT,PointOutT) template class PCL_EXPORTS pcl::BoundaryEstimation<PointInT, PointNT, PointOutT>;
void getCoordinateSystemOnPlane(const PointNT &p_coeff, Eigen::Vector4f &u, Eigen::Vector4f &v)
Get a u-v-n coordinate system that lies on a plane defined by its normal.
void computeFeature(PointCloudOut &output) override
Estimate whether a set of points is lying on surface boundaries using an angle criterion for all poin...
typename Feature< PointInT, PointOutT >::PointCloudOut PointCloudOut
bool isBoundaryPoint(const pcl::PointCloud< PointInT > &cloud, int q_idx, const pcl::Indices &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.
float angle_threshold_
The decision boundary (angle threshold) that marks points as boundary or regular.
PointCloudNConstPtr normals_
A pointer to the input dataset that contains the point normals of the XYZ dataset.
double search_parameter_
The actual search parameter (from either search_radius_ or k_).
int searchForNeighbors(std::size_t index, double parameter, pcl::Indices &indices, std::vector< float > &distances) const
Search for k-nearest neighbors using the spatial locator from setSearchmethod, and the given surface ...
int k_
The number of K nearest neighbors to use for each point.
PointCloudInConstPtr surface_
An input point cloud describing the surface that is to be used for nearest neighbors estimation.
PointCloudConstPtr input_
PointCloud represents the base class in PCL for storing collections of 3D points.
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...
IndicesAllocator<> Indices
Type used for indices in PCL.