3 #include <Eigen/Cholesky>
4 #include <Eigen/Geometry>
24 const Vector3f &reference0,
const Vector3f samples1[],
25 const Vector3f &reference1,
size_t n_samples)
30 Matrix<double, Dynamic, 3> X(n_samples, 3);
31 Matrix<double, Dynamic, 1>
y(n_samples, 1);
34 Quaterniond().setFromTwoVectors(reference0.cast<
double>(), reference1.cast<
double>()));
35 for (
size_t i = 0;
i < n_samples; ++
i) {
36 AngleAxisd observation(Quaterniond().setFromTwoVectors(samples0[
i].cast<double>(),
37 samples1[
i].cast<double>()));
39 X.row(
i) = observation.axis();
40 y[
i] = reference.angle() - observation.angle();
45 (X.transpose() * X).ldlt().solve(X.transpose() *
y, &result);
46 rotationVector = result.cast<
float>();
void calibration_misalignment(Vector3f &rotationVector, const Vector3f samples0[], const Vector3f &reference0, const Vector3f samples1[], const Vector3f &reference1, size_t n_samples)
Gui-less support class for calibration.