26 a_current.resize(
a.size());
33 const size_t n =
a.size();
35 for (
size_t i = 0; i < n; i++) {
67 for (
size_t i = 0; i < n; i++) {
68 N += (a_current[i] - a_current_cm) * (
b[
matches[i].pair] - b_cm).transpose();
70 auto svd = N.jacobiSvd(Eigen::ComputeFullU | Eigen::ComputeFullV);
71 const Matrix U = svd.matrixU();
73 Matrix R = V * U.transpose();
90 if (R.determinant() < 0) {
91 V = V * Eigen::DiagonalMatrix<double, 2>(1, -1);
92 R = V * U.transpose();
113void icp::Vanilla::compute_matches() {
114 const size_t n =
a.size();
115 const size_t m =
b.size();
117 for (
size_t i = 0; i < n; i++) {
118 matches[i].cost = std::numeric_limits<double>::infinity();
119 for (
size_t j = 0; j < m; j++) {
121 double dist_ij = (
b[j] - a_current[i]).squaredNorm();
123 if (dist_ij <
matches[i].cost) {
Configuration for ICP instances.
Interface for iterative closest points.
RBTransform transform
The current point cloud transformation that is being optimized.
std::vector< Vector > a
The source point cloud.
std::vector< Vector > b
The destination point cloud.
std::vector< Match > matches
The pairing of each point in a to its closest in b.
void iterate() override
Perform one iteration of ICP for the point clouds a and b provided with ICP::begin.
void setup() override
Per-method setup code.
Vector get_centroid(const std::vector< Vector > &points)