00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #pragma once
00036
00037 #include "PointMatcher.h"
00038
00039 #include <vector>
00040
00042 template<typename T>
00043 struct SurfaceNormalDataPointsFilter: public PointMatcher<T>::DataPointsFilter
00044 {
00045 typedef PointMatcherSupport::Parametrizable Parametrizable;
00046 typedef PointMatcherSupport::Parametrizable P;
00047 typedef Parametrizable::Parameters Parameters;
00048 typedef Parametrizable::ParameterDoc ParameterDoc;
00049 typedef Parametrizable::ParametersDoc ParametersDoc;
00050 typedef Parametrizable::InvalidParameter InvalidParameter;
00051
00052 typedef typename PointMatcher<T>::Vector Vector;
00053 typedef typename PointMatcher<T>::Matrix Matrix;
00054 typedef typename PointMatcher<T>::DataPoints DataPoints;
00055 typedef typename PointMatcher<T>::DataPoints::InvalidField InvalidField;
00056
00057 inline static const std::string description()
00058 {
00059 return "This filter extracts the surface normal vector and other statistics to each point by taking the eigenvector corresponding to the smallest eigenvalue of its nearest neighbors.\n\n"
00060 "Required descriptors: none.\n"
00061 "Produced descritors: normals(optional), densities(optional), eigValues(optional), eigVectors(optional), matchedIds (optional), meanDists(optional).\n"
00062 "Altered descriptors: none.\n"
00063 "Altered features: none.";
00064 }
00065 inline static const ParametersDoc availableParameters()
00066 {
00067 return {
00068 {"knn", "number of nearest neighbors to consider, including the point itself", "5", "3", "2147483647", &P::Comp<unsigned>},
00069 {"maxDist", "maximum distance to consider for neighbors", "inf", "0", "inf", &P::Comp<T>},
00070 {"epsilon", "approximation to use for the nearest-neighbor search", "0", "0", "inf", &P::Comp<T>},
00071 {"keepNormals", "whether the normals should be added as descriptors to the resulting cloud", "1"},
00072 {"keepDensities", "whether the point densities should be added as descriptors to the resulting cloud", "0"},
00073 {"keepEigenValues", "whether the eigen values should be added as descriptors to the resulting cloud", "0"},
00074 {"keepEigenVectors", "whether the eigen vectors should be added as descriptors to the resulting cloud", "0"},
00075 {"keepMatchedIds" , "whether the identifiers of matches points should be added as descriptors to the resulting cloud", "0"},
00076 {"keepMeanDist" , "whether the distance to the nearest neighbor mean should be added as descriptors to the resulting cloud", "0"},
00077 {"sortEigen" , "whether the eigenvalues and eigenvectors should be sorted (ascending) based on the eigenvalues", "0"},
00078 {"smoothNormals", "whether the normal vector should be average with the nearest neighbors", "0"}
00079 };
00080 }
00081
00082 const unsigned knn;
00083 const T maxDist;
00084 const T epsilon;
00085 const bool keepNormals;
00086 const bool keepDensities;
00087 const bool keepEigenValues;
00088 const bool keepEigenVectors;
00089 const bool keepMatchedIds;
00090 const bool keepMeanDist;
00091 const bool sortEigen;
00092 const bool smoothNormals;
00093
00094 SurfaceNormalDataPointsFilter(const Parameters& params = Parameters());
00095 virtual ~SurfaceNormalDataPointsFilter() {};
00096 virtual DataPoints filter(const DataPoints& input);
00097 virtual void inPlaceFilter(DataPoints& cloud);
00098 };