【问题标题】:OpenCV detect and compute image featuresOpenCV 检测和计算图像特征
【发布时间】:2020-03-11 19:20:15
【问题描述】:

最近从 3.4.5 升级了 OpenCV。到 OpenCV 4.2.0。

在我遵循这个拼接示例之前:https://github.com/opencv/opencv/blob/5131619a1a4d1d3a860b5da431742cc6be945332/samples/cpp/stitching_detailed.cpp(特别是第 480 行)。升级后,我更改了代码以更符合这个较新的示例:https://github.com/opencv/opencv/blob/master/samples/cpp/stitching_detailed.cpp(注意第 481 行)。

问题在于这个新的computeImageFeatures 功能,我检测到的功能较少。具有相同图像的旧代码给了我 1400 多个特征,但 computeImageFeatures 每张图像给了我正好 500 个特征。任何想法如何解决这一问题?我相信这也会导致“Bundle Adjuster”稍后失败。

【问题讨论】:

    标签: opencv image-processing panoramas image-stitching


    【解决方案1】:

    根据cv::ORB::create的文档,nfeatures参数的默认值为500

    第一个参数是nfeatures,您可以将第一个参数设置为更大的数字,如@9​​87654326@。

    这里是构造函数参数:

    static Ptr<ORB> cv::ORB::create (int     nfeatures = 500,
                                     float   scaleFactor = 1.2f,
                                     int     nlevels = 8,
                                     int     edgeThreshold = 31,
                                     int     firstLevel = 0,
                                     int     WTA_K = 2,
                                     int     scoreType = ORB::HARRIS_SCORE,
                                     int     patchSize = 31,
                                     int     fastThreshold = 20 
                                    )       
    

    尝试修改:

    if (features_type == "orb")
    {
        finder = ORB::create();
    }
    

    if (features_type == "orb")
    {
        finder = ORB::create(2000);
    }
    

    如果您使用的不是 ORB,而是其他类型的功能,请阅读构造函数的文档。
    我假设所有类型都有一个限制器参数。

    【讨论】:

    • 哇,谢谢,我不知道!我知道特征的数量正好是 500 有点可疑