39 #ifndef PCL_REGISTRATION_TRANSFORMATION_VALIDATION_EUCLIDEAN_IMPL_H_
40 #define PCL_REGISTRATION_TRANSFORMATION_VALIDATION_EUCLIDEAN_IMPL_H_
45 template <
typename Po
intSource,
typename Po
intTarget>
double
49 const Eigen::Matrix4f &transformation_matrix)
51 double fitness_score = 0.0;
61 tree_->setInputCloud (cloud_tgt);
63 std::vector<int> nn_indices (1);
64 std::vector<float> nn_dists (1);
68 for (
size_t i = 0; i < input_transformed.
points.size (); ++i)
71 tree_->nearestKSearch (input_transformed.
points[i], 1, nn_indices, nn_dists);
74 if (nn_dists[0] > max_range_)
78 Eigen::Vector4f p1 (input_transformed.
points[i].x,
79 input_transformed.
points[i].y,
80 input_transformed.
points[i].z, 0);
81 Eigen::Vector4f p2 (cloud_tgt->points[nn_indices[0]].x,
82 cloud_tgt->points[nn_indices[0]].y,
83 cloud_tgt->points[nn_indices[0]].z, 0);
85 fitness_score += fabs ((p1-p2).squaredNorm ());
90 return (fitness_score / nr);
92 return (std::numeric_limits<double>::max ());