39 #ifndef PCL_FEATURES_IMPL_PPF_H_
40 #define PCL_FEATURES_IMPL_PPF_H_
46 template <
typename Po
intInT,
typename Po
intNT,
typename Po
intOutT>
50 feature_name_ =
"PPFEstimation";
58 template <
typename Po
intInT,
typename Po
intNT,
typename Po
intOutT>
void
62 output.points.resize (indices_->size () * input_->points.size ());
64 output.width =
static_cast<uint32_t
> (output.points.size ());
65 output.is_dense =
true;
68 for (
size_t index_i = 0; index_i < indices_->size (); ++index_i)
70 size_t i = (*indices_)[index_i];
71 for (
size_t j = 0 ; j < input_->points.size (); ++j)
78 normals_->points[i].getNormalVector4fMap (),
79 input_->points[j].getVector4fMap (),
80 normals_->points[j].getNormalVector4fMap (),
81 p.f1, p.f2, p.f3, p.f4))
84 Eigen::Vector3f model_reference_point = input_->points[i].getVector3fMap (),
85 model_reference_normal = normals_->points[i].getNormalVector3fMap (),
86 model_point = input_->points[j].getVector3fMap ();
87 Eigen::AngleAxisf rotation_mg (acosf (model_reference_normal.dot (Eigen::Vector3f::UnitX ())),
88 model_reference_normal.cross (Eigen::Vector3f::UnitX ()).normalized ());
89 Eigen::Affine3f transform_mg = Eigen::Translation3f ( rotation_mg * ((-1) * model_reference_point)) * rotation_mg;
91 Eigen::Vector3f model_point_transformed = transform_mg * model_point;
92 float angle = atan2f ( -model_point_transformed(2), model_point_transformed(1));
93 if (sin (angle) * model_point_transformed(2) < 0.0f)
99 PCL_ERROR (
"[pcl::%s::computeFeature] Computing pair feature vector between points %zu and %zu went wrong.\n", getClassName ().c_str (), i, j);
100 p.f1 = p.f2 = p.f3 = p.f4 = p.alpha_m = std::numeric_limits<float>::quiet_NaN ();
101 output.is_dense =
false;
108 p.f1 = p.f2 = p.f3 = p.f4 = p.alpha_m = std::numeric_limits<float>::quiet_NaN ();
109 output.is_dense =
false;
112 output.points[index_i*input_->points.size () + j] = p;
118 template <
typename Po
intInT,
typename Po
intNT>
void
122 output.
points.resize (indices_->size () * input_->points.size (), 5);
124 output.
width =
static_cast<uint32_t
> (indices_->size () * input_->points.size ());
128 for (
size_t index_i = 0; index_i < indices_->size (); ++index_i)
130 size_t i = (*indices_)[index_i];
131 for (
size_t j = 0 ; j < input_->points.size (); ++j)
133 Eigen::VectorXf p (5);
138 normals_->points[i].getNormalVector4fMap (),
139 input_->points[j].getVector4fMap (),
140 normals_->points[j].getNormalVector4fMap (),
141 p (0), p (1), p (2), p (3)))
144 Eigen::Vector3f model_reference_point = input_->points[i].getVector3fMap (),
145 model_reference_normal = normals_->points[i].getNormalVector3fMap (),
146 model_point = input_->points[j].getVector3fMap ();
147 Eigen::AngleAxisf rotation_mg (acosf (model_reference_normal.dot (Eigen::Vector3f::UnitX ())),
148 model_reference_normal.cross (Eigen::Vector3f::UnitX ()).normalized ());
149 Eigen::Affine3f transform_mg = Eigen::Translation3f ( rotation_mg * ((-1) * model_reference_point)) * rotation_mg;
151 Eigen::Vector3f model_point_transformed = transform_mg * model_point;
152 float angle = atan2f ( -model_point_transformed(2), model_point_transformed(1));
153 if (sin (angle) * model_point_transformed(2) < 0.0f)
159 PCL_ERROR (
"[pcl::%s::computeFeature] Computing pair feature vector between points %zu and %zu went wrong.\n", getClassName ().c_str (), i, j);
160 p.setConstant (std::numeric_limits<float>::quiet_NaN ());
168 p.setConstant (std::numeric_limits<float>::quiet_NaN ());
172 output.
points.row (index_i*input_->points.size () + j) = p;
178 #define PCL_INSTANTIATE_PPFEstimation(T,NT,OutT) template class PCL_EXPORTS pcl::PPFEstimation<T,NT,OutT>;
181 #endif // PCL_FEATURES_IMPL_PPF_H_