13#include <unordered_map>
61 std::vector<Vector>
a;
64 std::vector<Vector>
b;
93 using Param = std::variant<int, double, std::string>;
94 std::unordered_map<std::string, Param> params;
102 void set(std::string key, T value) {
109 T
get(std::string key, T otherwise)
const {
110 if (params.find(key) == params.end()) {
113 return std::get<T>(params.at(
key));
122 void begin(
const std::vector<Vector>&
a,
const std::vector<Vector>&
b,
RBTransform t);
156 std::function<std::unique_ptr<ICP>(
const Config&)> constructor);
177 std::vector<std::function<std::unique_ptr<ICP>(
const ICP::Config&)>>
Configuration for ICP instances.
Config()
Constructs an empty configuration.
T get(std::string key, T otherwise) const
Retrieves the integer, double, or string value associated with key.
void set(std::string key, T value)
Associates key with an integer, double, or string value.
Interface for iterative closest points.
static bool register_method(std::string name, std::function< std::unique_ptr< ICP >(const Config &)> constructor)
Registers a new ICP method that can be created with constructor, returning false if name has already ...
double previous_cost
Keeps track of the previous cost to ensure that progress is being made.
static std::unique_ptr< ICP > from_method(std::string name, const Config ¶ms=Config())
Factory constructor for the ICP method name with configuration config.
RBTransform transform
The current point cloud transformation that is being optimized.
ConvergenceReport converge(size_t burn_in, double convergence_threshold)
Perform ICP for the point clouds a and b provided with ICP::begin until the cost is below convergence...
double current_cost
The RMS (root mean square) cost of the current transformation.
std::vector< Vector > a
The source point cloud relative to its centroid.
static const std::vector< std::string > & registered_methods()
Returns a current list of the names of currently registered ICP methods.
std::vector< Vector > b
The destination point cloud relative to its centroid.
std::vector< Match > matches
The pairing of each point in a to its closest in b.
void begin(const std::vector< Vector > &a, const std::vector< Vector > &b, RBTransform t)
Begins the ICP process for point clouds a and b with an initial guess for the transform t.
const RBTransform & current_transform() const
The current transform.
virtual void iterate()=0
Perform one iteration of ICP for the point clouds a and b provided with ICP::begin.
double calculate_cost() const
Computes the cost of the current transformation.
static bool is_registered_method(std::string name)
Whether name is a registered ICP method.
The result of running ICP::converge.
size_t iteration_count
The number of iterations performed, including the burn-in period.
double final_cost
The least cost achieved.
A point-to-point matching between point and pair at a distance of sqrt(sq_dist).
std::vector< std::function< std::unique_ptr< ICP >(const ICP::Config &)> registered_method_constructors)
std::vector< std::string > registered_method_names