-
Notifications
You must be signed in to change notification settings - Fork 38
/
icp.h
33 lines (24 loc) · 949 Bytes
/
icp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "Eigen/Eigen"
#include <vector>
#ifndef ICP_H
#define ICP_H
#define N_pt 30 // # of points in the datasets
#define N_tests 100 // # of test iterations
#define noise_sigma 0.01 // standard deviation error to be added
#define translation 0.1 // max translation of the test set
#define rotation 0.1 // max rotation (radians) of the test set
typedef struct{
Eigen::Matrix4d trans;
std::vector<float> distances;
int iter;
} ICP_OUT;
typedef struct{
std::vector<float> distances;
std::vector<int> indices;
} NEIGHBOR;
Eigen::Matrix4d best_fit_transform(const Eigen::MatrixXd &A, const Eigen::MatrixXd &B);
ICP_OUT icp(const Eigen::MatrixXd &A, const Eigen::MatrixXd &B, int max_iterations=20, int tolerance = 0.001);
// throughout method
NEIGHBOR nearest_neighbot(const Eigen::MatrixXd &src, const Eigen::MatrixXd &dst);
float dist(const Eigen::Vector3d &pta, const Eigen::Vector3d &ptb);
#endif