【问题标题】:How can I compute SVD and and verify that the ratio of the first-to-last singular value is sane with OpenCV?如何计算 SVD 并验证第一个奇异值与最后一个奇异值的比率是否与 OpenCV 一致?
【发布时间】:2013-05-08 11:43:50
【问题描述】:

我想验证单应矩阵会给出好的结果,而这个this answer 有一个答案 - 但是,我不知道如何实现答案。
那么任何人都可以推荐我如何使用 OpenCV 计算 SVD 并验证第一个奇异值与最后一个奇异值的比率是否合理?

【问题讨论】:

  • 您好托尼,我也有同样的问题。而且我可以看到如何计算 SVD,但我仍然不明白“验证第一个奇异值与最后一个奇异值的比率是否正常”的部分。你能解决这个问题吗?谢谢
  • 对此没有确切的解决方案。我针对自己的具体问题做了很多测试,自己决定了一个阈值。

标签: opencv svd


【解决方案1】:

在 OpenCV 中有几种计算 SVD 的方法:

cv::SVD homographySVD(homography, cv::SVD::FULL_UV); // constructor
// or: 
homographySVD(newHomography, cv::SVD::FULL_UV); // operator ()
homographySVD.w.at<double>(0, 0); // access the first singular value

// alternatives:
cv::SVD::compute(homography, w); // compute just the singular values
cv::eigen(homography, w);

查看cv::SVDcv::eigen 的文档了解更多详情。

【讨论】:

  • 有人能在 Python 中做出同样的贡献吗?
【解决方案2】:

您可以使用numpy 在 python 中计算 SVD。 例如:

    import numpy as np
    U, s, V = np.linalg.svd(a, full_matrices=True)

将矩阵a 的维度M x N 分解为u * np.diag(s) * v,其中uv 是单一的,sa 的奇异值的一维数组。

更多内容请关注here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-05-12
    • 2021-05-08
    • 2017-04-29
    • 2010-10-06
    • 2023-03-21
    • 2011-06-30
    • 2020-07-23
    • 2016-01-10
    相关资源
    最近更新 更多