Open3D (C++ API)  0.19.0
Loading...
Searching...
No Matches
SymmetricICPImpl.h
Go to the documentation of this file.
1// ----------------------------------------------------------------------------
2// - Open3D: www.open3d.org -
3// ----------------------------------------------------------------------------
4// Copyright (c) 2018-2024 www.open3d.org
5// SPDX-License-Identifier: MIT
6// ----------------------------------------------------------------------------
7
8#pragma once
9
10#include <Eigen/Geometry>
11#include <cmath>
12
14
15namespace open3d {
16namespace pipelines {
17namespace registration {
18
19inline Eigen::Matrix4d TransformSymmetricPoseToMatrix4d(
20 const Eigen::Vector6d &pose,
21 const Eigen::Vector3d &source_mean,
22 const Eigen::Vector3d &target_mean) {
23 const Eigen::Vector3d g = pose.head<3>();
24 const double g_norm = g.norm();
25 const double theta = std::atan(g_norm);
26
27 Eigen::Matrix3d half_rotation = Eigen::Matrix3d::Identity();
28 if (g_norm > 0.0) {
29 half_rotation = Eigen::AngleAxisd(theta, g / g_norm).toRotationMatrix();
30 }
31
32 // Symmetric ICP solves for a half-angle pose about correspondence means.
33 // Equation 11 converts it to the full rigid transformation.
34 const Eigen::Matrix3d rotation = half_rotation * half_rotation;
35 const Eigen::Vector3d translation =
36 target_mean + half_rotation * (pose.tail<3>() * std::cos(theta)) -
37 rotation * source_mean;
38
39 Eigen::Matrix4d transformation = Eigen::Matrix4d::Identity();
40 transformation.block<3, 3>(0, 0) = rotation;
41 transformation.block<3, 1>(0, 3) = translation;
42 return transformation;
43}
44
45} // namespace registration
46} // namespace pipelines
47} // namespace open3d
Eigen::Matrix4d TransformSymmetricPoseToMatrix4d(const Eigen::Vector6d &pose, const Eigen::Vector3d &source_mean, const Eigen::Vector3d &target_mean)
Definition SymmetricICPImpl.h:19
Definition PinholeCameraIntrinsic.cpp:16