From 7f812c9415943d6d5bd9063c8bb46aea8878c519 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Wed, 3 Dec 2025 16:45:14 +0100 Subject: [PATCH] fix rotation matrix construction in column-major order --- orbbec_camera/src/utils.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/orbbec_camera/src/utils.cpp b/orbbec_camera/src/utils.cpp index e7945e0e..b9fd2d58 100644 --- a/orbbec_camera/src/utils.cpp +++ b/orbbec_camera/src/utils.cpp @@ -199,10 +199,9 @@ void savePointsToPly(const std::shared_ptr &frame, const std::string tf2::Quaternion rotationMatrixToQuaternion(const float rotation[9]) { Eigen::Matrix3f m; - // We need to be careful about the order, as RS2 rotation matrix is - // column-major, while Eigen::Matrix3f expects row-major. - m << rotation[0], rotation[1], rotation[2], rotation[3], rotation[4], rotation[5], rotation[6], - rotation[7], rotation[8]; + m << rotation[0], rotation[3], rotation[6], + rotation[2], rotation[4], rotation[7], + rotation[3], rotation[5], rotation[8]; Eigen::Quaternionf q(m); return {q.x(), q.y(), q.z(), q.w()}; }