繁体   English   中英

旋转矩阵特征库

[英]Rotate matrix Eigen library

如何将存储在特征矩阵中的二维图像顺时针旋转 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();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM