【发布时间】:2018-06-17 20:49:56
【问题描述】:
问题:我正在尝试使用 Eigen JacobiSVD 模块计算旋转矩阵的 SVD,以计算旋转矩阵的单值分解。
预期:我应该能够将 Eigen::Affine3d 类型的旋转矩阵传递给 svd 方法,然后使用 SVD 中的 U 和 V 生成一个新的 Eigen 类型的旋转矩阵::Affine3d。
观察到 svd 方法不接受我的 tSixDof 矩阵作为可接受的参数。
问题为什么我不能使用仿射矩阵作为输入?有没有更好的方法来执行这个操作?
// Resolve numerical errors in the rotation matrix by implementing the
// orthogonal procrustes problem algorithm.
void SixDof::resolveRotation()
{
//initial SixDof
SixDof tSixDof;
Eigen::Index n = tSixDof.rows();
Eigen::Index m = tSixDof.rows();
Eigen::Matrix3d U;
Eigen::Matrix3d V;
Eigen::Matrix3d R;
Eigen::JacobiSVD<Eigen::Matrix3d> svd(tSixDof.rotation()
Eigen::ComputeFullU | Eigen::ComputeFullV);
U = svd.matrixU();
V = svd.matrixV();
R = U*V.transpose();
//Resolved SixDof
tSixDof.rotation() = R;
}
SixDof 类
class SixDof : public Eigen::Affine3d
{
public:
SixDof();
SixDof(const Eigen::Affine3d& aOther);
void resolveRotation();
};
【问题讨论】:
标签: c++ computer-vision eigen svd