如何将存储在Eigen矩阵中的2d图像顺时针旋转90度? 我的代码: Eigen::Matrix<int, n, n> m; Eigen::Rotation2D rot(90); auto m1 = m * rot.derived(); 但是我收到了一个错误: error: static_assert failed due to requirement 'ProductIsValid || SameSizes' "INVALID_MATRIX_PRODUCT"
旋转逆时针,Eigen::Matrix<int, n, n> m_rotated_ninty_ccwise = m.transpose().colwise().reverse(); 顺时针旋转, Eigen::Matrix<int, n, n> m_rotated_ninty_cwise = m.reverse().transpose().reverse();
Eigen::Rotation2D
不会旋转矩阵,它是用来让二维空间中的点绕坐标原点 (0, 0) 旋转的。Eigen::Rotation2D
是一个 2x2 的矩阵,例如(0 1; -1 0) * (2 1) = (1 -2)
就是一个旋转操作。 - user15388024R.transpose().colwise().reverse()
。 - chtzEigen::Rotation2D
是一个2x2矩阵,..." 应该改为 "Eigen::Rotation2D
的行为类似于2x2矩阵,..."。我想简化了它,过于简单化了 :-) - user15388024