41 #ifndef PCL_REGISTRATION_TRANSFORMATION_VALIDATION_EUCLIDEAN_IMPL_H_
42 #define PCL_REGISTRATION_TRANSFORMATION_VALIDATION_EUCLIDEAN_IMPL_H_
46 namespace registration {
48 template <
typename Po
intSource,
typename Po
intTarget,
typename Scalar>
53 const Matrix4& transformation_matrix)
const
55 double fitness_score = 0.0;
60 input_transformed.
resize(cloud_src->size());
61 for (std::size_t i = 0; i < cloud_src->size(); ++i) {
62 const PointSource& src = (*cloud_src)[i];
63 PointTarget& tgt = input_transformed[i];
64 tgt.x =
static_cast<float>(
65 transformation_matrix(0, 0) * src.x + transformation_matrix(0, 1) * src.y +
66 transformation_matrix(0, 2) * src.z + transformation_matrix(0, 3));
67 tgt.y =
static_cast<float>(
68 transformation_matrix(1, 0) * src.x + transformation_matrix(1, 1) * src.y +
69 transformation_matrix(1, 2) * src.z + transformation_matrix(1, 3));
70 tgt.z =
static_cast<float>(
71 transformation_matrix(2, 0) * src.x + transformation_matrix(2, 1) * src.y +
72 transformation_matrix(2, 2) * src.z + transformation_matrix(2, 3));
76 if (!force_no_recompute_) {
77 tree_->setPointRepresentation(point_rep);
78 tree_->setInputCloud(cloud_tgt);
82 std::vector<float> nn_dists(1);
86 for (
const auto& point : input_transformed) {
88 tree_->nearestKSearch(point, 1, nn_indices, nn_dists);
91 if (nn_dists[0] > max_range_)
95 fitness_score += nn_dists[0];
100 return (fitness_score / nr);
101 return (std::numeric_limits<double>::max());
void resize(std::size_t count)
Resizes the container to contain count elements.
IndicesAllocator<> Indices
Type used for indices in PCL.