Eigen C ++;具有Eigen :: Transform的欧几里德变换

问题描述 投票:0回答:1

给定旋转矩阵3x3 R和3维平移向量t的欧几里德变换,如何使用Eigen::Transform实现欧几里德变换?

X = R * X + t

我目前的方法无效:

Eigen::Transform<Type, 3, Eigen::Projective>  transformation;
...

Eigen::AngleAxis           rotation(R);
Eigen::Translation<Type,3> translation(t);

transformation = translation * rotation;

现在,我想逐列地应用于更大的矢量集,即3xN矩阵X,其中每列代表要变换的矢量,即

 X = transformation * X

但是,这不起作用并产生一个断言:

test-depth.exe: /usr/include/eigen3/Eigen/src/Core/Product.h:133: Eigen::Product<Lhs, Rhs, Option>::Product(const Lhs&, const Rhs&) [with _Lhs = Eigen::Matrix<double, 4, 4>; _Rhs = Eigen::Matrix<double, -1, -1>; int Option = 0; Eigen::Product<Lhs, Rhs, Option>::Lhs = Eigen::Matrix<double, 4, 4>; Eigen::Product<Lhs, Rhs, Option>::Rhs = Eigen::Matrix<double, -1, -1>]: Assertion `lhs.cols() == rhs.rows() && "invalid matrix product" && "if you wanted a coeff-wise or a dot product use the respective explicit functions"' failed.
c++ geometry linear-algebra eigen eigen3
1个回答
2
投票

MBo的评论是对的,你使用了Projective变换,它涉及完整的齐次坐标。如果你想在引擎盖下使用Affine矩阵,你需要使用AffineCompact变换或3x4

© www.soinside.com 2019 - 2024. All rights reserved.