找出单应矩阵是否良好

时间:2015-11-30 19:02:02

标签: opencv matrix homography

我在OpenCV论坛上找到了this代码,它运行正常,可以检测出错误的单应性。但我无法找到它背后的理论。

有人能解释完整的理论吗?

代码:

bool niceHomography(Mat HM)
{
    const double det = HM.at<double>(0, 0) * HM.at<double>(1, 1) - HM.at<double>(1, 0) * HM.at<double>(0, 1);
    if (det < 0)
        return false;

    const double N1 = sqrt(HM.at<double>(0, 0) * HM.at<double>(0, 0) + HM.at<double>(1, 0) * HM.at<double>(1, 0));
    if (N1 > 4 || N1 < 0.1)
        return false;

    const double N2 = sqrt(HM.at<double>(0, 1) * HM.at<double>(0, 1) + HM.at<double>(1, 1) * HM.at<double>(1, 1));
    if (N2 > 4 || N2 < 0.1)
        return false;

    const double N3 = sqrt(HM.at<double>(2, 0) * HM.at<double>(2, 0) + HM.at<double>(2, 1) * HM.at<double>(2, 1));
    if (N3 > 0.002)
        return false;

    return true;
}

0 个答案:

没有答案