79 const double max_distance)
84 correspondences.resize(indices_->size());
85 std::size_t c_index = 0;
87 for (
const auto& src_idx : (*indices_)) {
89 const Eigen::Vector4f p_src(src_to_tgt_transformation_ *
90 (*input_)[src_idx].getVector4fMap());
91 const Eigen::Vector3f p_src3(p_src[0], p_src[1], p_src[2]);
92 const Eigen::Vector3f uv(projection_matrix_ * p_src3);
98 const int u =
static_cast<int>(uv[0] / uv[2]);
99 const int v =
static_cast<int>(uv[1] / uv[2]);
101 if (u >= 0 && u <
static_cast<int>(target_->width) && v >= 0 &&
102 v < static_cast<int>(target_->height)) {
103 const PointTarget& pt_tgt = target_->at(u, v);
107 if (std::abs(uv[2] - pt_tgt.z) > depth_threshold_)
110 const double dist = (p_src3 - pt_tgt.getVector3fMap()).norm();
111 if (dist < max_distance)
113 src_idx, v * target_->width + u,
static_cast<float>(dist));
118 correspondences.resize(c_index);