39 #ifndef PCL_FEATURES_IMPL_GRSD_H_
40 #define PCL_FEATURES_IMPL_GRSD_H_
42 #include <pcl/features/grsd.h>
43 #include <pcl/features/rsd.h>
45 template <
typename Po
intInT,
typename Po
intNT,
typename Po
intOutT>
int
47 double min_radius_plane,
48 double max_radius_noise,
49 double min_radius_cylinder,
50 double max_min_radius_diff)
52 if (min_radius > min_radius_plane)
54 if (max_radius > min_radius_cylinder)
56 if (min_radius < max_radius_noise)
58 if (max_radius - min_radius < max_min_radius_diff)
64 template <
typename Po
intInT,
typename Po
intNT,
typename Po
intOutT>
void
70 PCL_ERROR (
"[pcl::%s::computeFeature] A voxel cell width needs to be set!\n", getClassName ().c_str ());
82 grid.
filter (*cloud_downsampled);
91 if (rsd_nr_subdiv_ != 0)
93 if (rsd_plane_radius_ != 0.0)
99 std::vector<int> types (radii->
size ());
100 std::transform(radii->
points.cbegin (), radii->
points.cend (), types.begin (),
101 [](
const auto& point) {
103 return GRSDEstimation<PointInT, PointNT, PointOutT>::getSimpleType(point.r_min, point.r_max); });
106 Eigen::MatrixXi transition_matrix = Eigen::MatrixXi::Zero (NR_CLASS + 1, NR_CLASS + 1);
107 for (std::size_t idx = 0; idx < cloud_downsampled->size (); ++idx)
109 const int source_type = types[idx];
111 for (
const int &neighbor : neighbors)
113 int neighbor_type = NR_CLASS;
115 neighbor_type = types[neighbor];
116 transition_matrix (source_type, neighbor_type)++;
124 for (
int i = 0; i < NR_CLASS + 1; i++)
125 for (
int j = i; j < NR_CLASS + 1; j++)
126 output[0].histogram[nrf++] = transition_matrix (i, j) + transition_matrix (j, i);
129 #define PCL_INSTANTIATE_GRSDEstimation(T,NT,OutT) template class PCL_EXPORTS pcl::GRSDEstimation<T,NT,OutT>;
void setInputNormals(const PointCloudNConstPtr &normals)
Provide a pointer to the input dataset that contains the point normals of the XYZ dataset.
typename PointCloudIn::Ptr PointCloudInPtr
void setSearchSurface(const PointCloudInConstPtr &cloud)
Provide a pointer to a dataset to add additional information to estimate the features for every point...
void setRadiusSearch(double radius)
Set the sphere radius that is to be used for determining the nearest neighbors used for the feature e...
void compute(PointCloudOut &output)
Base method for feature estimation for all points given in <setInputCloud (), setIndices ()> using th...
void filter(PointCloud &output)
Calls the filtering method and returns the filtered dataset in output.
static int getSimpleType(float min_radius, float max_radius, double min_radius_plane=0.100, double max_radius_noise=0.015, double min_radius_cylinder=0.175, double max_min_radius_diff=0.050)
Get the type of the local surface based on the min and max radius computed.
void computeFeature(PointCloudOut &output) override
Estimate the Global Radius-based Surface Descriptor (GRSD) for a set of points given by <setInputClou...
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Provide a pointer to the input dataset.
void resize(std::size_t count)
Resizes the container to contain count elements.
std::uint32_t width
The point cloud width (if organized as an image-structure).
std::uint32_t height
The point cloud height (if organized as an image-structure).
void clear()
Removes all points in a cloud and sets the width and height to 0.
shared_ptr< PointCloud< PointT > > Ptr
std::vector< PointT, Eigen::aligned_allocator< PointT > > points
The point data.
RSDEstimation estimates the Radius-based Surface Descriptor (minimal and maximal radius of the local ...
void setNrSubdivisions(int nr_subdiv)
Set the number of subdivisions for the considered distance interval.
void setPlaneRadius(double plane_radius)
Set the maximum radius, above which everything can be considered planar.
VoxelGrid assembles a local 3D grid over a given PointCloud, and downsamples + filters the data.
void setLeafSize(const Eigen::Vector4f &leaf_size)
Set the voxel grid leaf size.
void setSaveLeafLayout(bool save_leaf_layout)
Set to true if leaf layout information needs to be saved for later access.
std::vector< int > getNeighborCentroidIndices(const PointT &reference_point, const Eigen::MatrixXi &relative_coordinates) const
Returns the indices in the resulting downsampled cloud of the points at the specified grid coordinate...