41#include <pcl/common/utils.h>
42#include <pcl/filters/filter.h>
55 template <
typename NormalT>
inline std::vector<float>
64 PCL_ERROR(
"[pcl::assignNormalWeights] inequal size of neighbor indices and distances!\n");
82 template <
typename NormalT>
inline bool
90 point.normal_x = 0.0f;
91 point.normal_y = 0.0f;
92 point.normal_z = 0.0f;
97 PCL_ERROR(
"[pcl::refineNormal] inequal size of neighbor indices and distances!\n");
113 if (std::isfinite (
pointi.normal_x) && std::isfinite (
pointi.normal_y) && std::isfinite (
pointi.normal_z))
115 const float&
weighti = weights[i];
123 const float norm = std::sqrt (
nx *
nx +
ny *
ny +
nz *
nz);
124 if (std::isfinite (norm) && norm > std::numeric_limits<float>::epsilon ())
126 point.normal_x =
nx / norm;
127 point.normal_y =
ny / norm;
128 point.normal_z =
nz / norm;
189 template<
typename NormalT>
242 k_indices.assign (k_indices_.begin (), k_indices_.end ());
243 k_sqr_distances.assign (k_sqr_distances_.begin (), k_sqr_distances_.end ());
261 return max_iterations_;
279 return convergence_threshold_;
291 std::vector< Indices > k_indices_;
294 std::vector< std::vector<float> > k_sqr_distances_;
297 unsigned int max_iterations_;
300 float convergence_threshold_;
304#ifdef PCL_NO_PRECOMPILE
305#include <pcl/filters/impl/normal_refinement.hpp>
307#define PCL_INSTANTIATE_NormalRefinement(T) template class PCL_EXPORTS pcl::NormalRefinement<T>;
Iterator class for point clouds with or without given indices.
std::size_t size() const
Size of the range the iterator is going through.
Filter represents the base filter class.
const std::string & getClassName() const
Get a string representation of the name of this class.
std::string filter_name_
The filter name.
Normal vector refinement class
void setConvergenceThreshold(float convergence_threshold)
Set convergence threshold.
void getCorrespondences(std::vector< Indices > &k_indices, std::vector< std::vector< float > > &k_sqr_distances)
Get correspondences (copy)
float getConvergenceThreshold()
Get convergence threshold.
void applyFilter(PointCloud &output) override
Filter a Point Cloud.
NormalRefinement(const std::vector< Indices > &k_indices, const std::vector< std::vector< float > > &k_sqr_distances)
Constructor for setting correspondences, sets default convergence parameters.
unsigned int getMaxIterations()
Get maximum iterations.
void setMaxIterations(unsigned int max_iterations)
Set maximum iterations.
void setCorrespondences(const std::vector< Indices > &k_indices, const std::vector< std::vector< float > > &k_sqr_distances)
Set correspondences calculated from nearest neighbor search.
NormalRefinement()
Empty constructor, sets default convergence parameters.
PointCloudConstPtr input_
The input point cloud dataset.
PointCloud represents the base class in PCL for storing collections of 3D points.
shared_ptr< PointCloud< PointT > > Ptr
shared_ptr< const PointCloud< PointT > > ConstPtr
std::vector< float > assignNormalWeights(const PointCloud< NormalT > &cloud, index_t index, const Indices &k_indices, const std::vector< float > &k_sqr_distances)
Assign weights of nearby normals used for refinement.
bool refineNormal(const PointCloud< NormalT > &cloud, int index, const Indices &k_indices, const std::vector< float > &k_sqr_distances, NormalT &point)
Refine an indexed point based on its neighbors, this function only writes to the normal_* fields.
void ignore(const T &...)
Utility function to eliminate unused variable warnings.
detail::int_type_t< detail::index_type_size, detail::index_type_signed > index_t
Type used for an index in PCL.
IndicesAllocator<> Indices
Type used for indices in PCL.
Defines all the PCL and non-PCL macros used.
A point structure representing normal coordinates and the surface curvature estimate.