40 #ifndef PCL_FEATURES_IMPL_PPF_H_
41 #define PCL_FEATURES_IMPL_PPF_H_
43 #include <pcl/features/ppf.h>
44 #include <pcl/features/pfh.h>
47 template <
typename Po
intInT,
typename Po
intNT,
typename Po
intOutT>
59 template <
typename Po
intInT,
typename Po
intNT,
typename Po
intOutT>
void
63 output.points.resize (indices_->size () * input_->points.size ());
65 output.width =
static_cast<uint32_t
> (output.points.size ());
66 output.is_dense =
true;
69 for (
size_t index_i = 0; index_i < indices_->size (); ++index_i)
71 size_t i = (*indices_)[index_i];
72 for (
size_t j = 0 ; j < input_->points.size (); ++j)
79 normals_->points[i].getNormalVector4fMap (),
80 input_->points[j].getVector4fMap (),
81 normals_->points[j].getNormalVector4fMap (),
82 p.f1, p.f2, p.f3, p.f4))
85 Eigen::Vector3f model_reference_point = input_->points[i].getVector3fMap (),
86 model_reference_normal = normals_->points[i].getNormalVector3fMap (),
87 model_point = input_->points[j].getVector3fMap ();
88 Eigen::AngleAxisf rotation_mg (acosf (model_reference_normal.dot (Eigen::Vector3f::UnitX ())),
89 model_reference_normal.cross (Eigen::Vector3f::UnitX ()).normalized ());
90 Eigen::Affine3f transform_mg = Eigen::Translation3f ( rotation_mg * ((-1) * model_reference_point)) * rotation_mg;
92 Eigen::Vector3f model_point_transformed = transform_mg * model_point;
93 float angle = atan2f ( -model_point_transformed(2), model_point_transformed(1));
94 if (sin (angle) * model_point_transformed(2) < 0.0f)
100 PCL_ERROR (
"[pcl::%s::computeFeature] Computing pair feature vector between points %zu and %zu went wrong.\n", getClassName ().c_str (), i, j);
101 p.f1 = p.f2 = p.f3 = p.f4 = p.alpha_m = std::numeric_limits<float>::quiet_NaN ();
102 output.is_dense =
false;
109 p.f1 = p.f2 = p.f3 = p.f4 = p.alpha_m = std::numeric_limits<float>::quiet_NaN ();
110 output.is_dense =
false;
113 output.points[index_i*input_->points.size () + j] = p;
118 #define PCL_INSTANTIATE_PPFEstimation(T,NT,OutT) template class PCL_EXPORTS pcl::PPFEstimation<T,NT,OutT>;
121 #endif // PCL_FEATURES_IMPL_PPF_H_
Class that calculates the "surflet" features for each pair in the given pointcloud.
std::string feature_name_
The feature name.
PCL_EXPORTS bool computePairFeatures(const Eigen::Vector4f &p1, const Eigen::Vector4f &n1, const Eigen::Vector4f &p2, const Eigen::Vector4f &n2, float &f1, float &f2, float &f3, float &f4)
Compute the 4-tuple representation containing the three angles and one distance between two points re...
Feature represents the base feature class.
PPFEstimation()
Empty Constructor.
search::KdTree is a wrapper class which inherits the pcl::KdTree class for performing search function...