gtsam_points
Loading...
Searching...
No Matches
graduated_non_convexity.hpp
1// SPDX-License-Identifier: MIT
2// Copyright (c) 2025 Kenji Koide (k.koide@aist.go.jp)
3#pragma once
4
5#include <random>
6#include <Eigen/Core>
7#include <Eigen/Geometry>
8
9#include <gtsam_points/types/point_cloud.hpp>
10#include <gtsam_points/ann/nearest_neighbor_search.hpp>
11#include <gtsam_points/registration/registration_result.hpp>
12
13namespace gtsam_points {
14
16struct GNCParams {
17public:
18 // Feature matching parameters
19 int max_init_samples = 5000;
20 bool reciprocal_check = true;
21 bool tuple_check = false;
22 double tuple_thresh = 0.9;
23 int max_num_tuples = 1000;
24
25 // Estimation praameters
26 double div_factor = 1.4;
27 double max_corr_dist = 0.25;
29 int max_iterations = 64;
30 int dof = 6;
31
32 // Misc
33 bool verbose = false;
34 std::uint64_t seed = 5489u;
35 int num_threads = 4;
36};
37
49template <typename PointCloud, typename Features>
50RegistrationResult estimate_pose_gnc_(
51 const PointCloud& target,
52 const PointCloud& source,
53 const Features& target_features,
54 const Features& source_features,
55 const NearestNeighborSearch& target_tree,
56 const NearestNeighborSearch& target_features_tree,
57 const NearestNeighborSearch& source_features_tree,
58 const GNCParams& params = GNCParams());
59
60//
61RegistrationResult estimate_pose_gnc(
62 const PointCloud& target,
63 const PointCloud& source,
64 const Eigen::Matrix<double, 33, 1>* target_features,
65 const Eigen::Matrix<double, 33, 1>* source_features,
66 const NearestNeighborSearch& target_tree,
67 const NearestNeighborSearch& target_features_tree,
68 const NearestNeighborSearch& source_features_tree,
69 const GNCParams& params = GNCParams()) {
70 using ConstFeaturePtr = const Eigen::Matrix<double, 33, 1>*;
71 return estimate_pose_gnc_<PointCloud, ConstFeaturePtr>(
72 target, source, target_features, source_features, target_tree, target_features_tree, source_features_tree, params);
73}
74
75RegistrationResult estimate_pose_gnc(
76 const PointCloud& target,
77 const PointCloud& source,
78 const Eigen::Matrix<double, 125, 1>* target_features,
79 const Eigen::Matrix<double, 125, 1>* source_features,
80 const NearestNeighborSearch& target_tree,
81 const NearestNeighborSearch& target_features_tree,
82 const NearestNeighborSearch& source_features_tree,
83 const GNCParams& params = GNCParams()) {
84 using ConstFeaturePtr = const Eigen::Matrix<double, 125, 1>*;
85 return estimate_pose_gnc_<PointCloud, ConstFeaturePtr>(
86 target, source, target_features, source_features, target_tree, target_features_tree, source_features_tree, params);
87}
88
89RegistrationResult estimate_pose_gnc(
90 const PointCloud& target,
91 const PointCloud& source,
92 const Eigen::VectorXd* target_features,
93 const Eigen::VectorXd* source_features,
94 const NearestNeighborSearch& target_tree,
95 const NearestNeighborSearch& target_features_tree,
96 const NearestNeighborSearch& source_features_tree,
97 const GNCParams& params = GNCParams()) {
98 using ConstFeaturePtr = const Eigen::VectorXd*;
99 return estimate_pose_gnc_<PointCloud, ConstFeaturePtr>(
100 target, source, target_features, source_features, target_tree, target_features_tree, source_features_tree, params);
101}
102
103} // namespace gtsam_points
Parameters for graduated non-convexity..
Definition graduated_non_convexity.hpp:16
bool verbose
Verbose mode.
Definition graduated_non_convexity.hpp:33
double div_factor
Division factor for graduated non-convexity.
Definition graduated_non_convexity.hpp:26
int max_num_tuples
Number of tuples to be sampled.
Definition graduated_non_convexity.hpp:23
bool tuple_check
Length similarity check.
Definition graduated_non_convexity.hpp:21
int max_init_samples
Maximum number of samples.
Definition graduated_non_convexity.hpp:19
int dof
Degrees of freedom (must be 6 (SE3) or 4 (XYZ+RZ))
Definition graduated_non_convexity.hpp:30
std::uint64_t seed
Random seed.
Definition graduated_non_convexity.hpp:34
int num_threads
Number of threads.
Definition graduated_non_convexity.hpp:35
double tuple_thresh
Length similarity threshold.
Definition graduated_non_convexity.hpp:22
bool reciprocal_check
Reciprocal check.
Definition graduated_non_convexity.hpp:20
int innter_iterations
Number of inner iterations.
Definition graduated_non_convexity.hpp:28
int max_iterations
Maximum number of iterations.
Definition graduated_non_convexity.hpp:29
double max_corr_dist
Maximum correspondence distance.
Definition graduated_non_convexity.hpp:27
Nearest neighbor search interface.
Definition nearest_neighbor_search.hpp:16
Standard point cloud class that holds only pointers to point attributes.
Definition point_cloud.hpp:19
Registration result.
Definition registration_result.hpp:11