[英]Eigen C++; Euclidean Transformation with Eigen::Transform
给定通过旋转矩阵3x3 R
和3维平移向量t
进行的欧几里德变换,如何使用Eigen::Transform
实现欧几里德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.
MBo的评论是正确的,您使用了包含完全齐次坐标的Projective
变换。 如果要在引擎盖下使用3x4
矩阵,则需要使用Affine
变换或AffineCompact
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.