当前位置: 首页>>代码示例>>C++>>正文


C++ Stitcher::setFeaturesMatcher方法代码示例

本文整理汇总了C++中Stitcher::setFeaturesMatcher方法的典型用法代码示例。如果您正苦于以下问题:C++ Stitcher::setFeaturesMatcher方法的具体用法?C++ Stitcher::setFeaturesMatcher怎么用?C++ Stitcher::setFeaturesMatcher使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Stitcher的用法示例。


在下文中一共展示了Stitcher::setFeaturesMatcher方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: imread

PERF_TEST_P(stitch, a123, TEST_DETECTORS)
{
    Mat pano;

    vector<Mat> imgs;
    imgs.push_back( imread( getDataPath("stitching/a1.png") ) );
    imgs.push_back( imread( getDataPath("stitching/a2.png") ) );
    imgs.push_back( imread( getDataPath("stitching/a3.png") ) );

    Ptr<detail::FeaturesFinder> featuresFinder = GetParam() == "orb"
            ? Ptr<detail::FeaturesFinder>(new detail::OrbFeaturesFinder())
            : Ptr<detail::FeaturesFinder>(new detail::SurfFeaturesFinder());

    Ptr<detail::FeaturesMatcher> featuresMatcher = GetParam() == "orb"
            ? makePtr<detail::BestOf2NearestMatcher>(false, ORB_MATCH_CONFIDENCE)
            : makePtr<detail::BestOf2NearestMatcher>(false, SURF_MATCH_CONFIDENCE);

    declare.time(30 * 20).iterations(20);

    while(next())
    {
        Stitcher stitcher = Stitcher::createDefault();
        stitcher.setFeaturesFinder(featuresFinder);
        stitcher.setFeaturesMatcher(featuresMatcher);
        stitcher.setWarper(makePtr<SphericalWarper>());
        stitcher.setRegistrationResol(WORK_MEGAPIX);

        startTimer();
        stitcher.stitch(imgs, pano);
        stopTimer();
    }

    EXPECT_NEAR(pano.size().width, 1182, 50);
    EXPECT_NEAR(pano.size().height, 682, 30);

    SANITY_CHECK_NOTHING();
}
开发者ID:112000,项目名称:opencv,代码行数:37,代码来源:perf_stich.cpp

示例2: process

void App::process()
{
    if (sources.empty())
    {
        cout << "Loading default images...\n";
        sources.resize(2);
        sources[0] = new ImageSource("data/stitching/t100mA.JPG");
        sources[1] = new ImageSource("data/stitching/t100mB.JPG");
    }

    stitcher_cpu.setFeaturesMatcher(new cv::detail::BestOf2NearestMatcher(false, 0.5));
    stitcher_gpu.setFeaturesMatcher(new cv::detail::BestOf2NearestMatcher(true, 0.5));

    cout << "\nControls:\n"
         << "  space - chanege CPU/GPU mode\n\n";

    vector<Mat> imgs(sources.size());
    Mat pano;

    double total_fps = 0;
    bool first_iter_cpu = true;
    bool first_iter_gpu = true;

    while (!exited)
    {
        int64 start = getTickCount();

        for (size_t i = 0; i < sources.size(); ++i)
            sources[i]->next(imgs[i]);

        int64 proc_start = getTickCount();

        if (use_gpu)
        {
            if (first_iter_gpu)
            {
                stitcher_gpu.estimateTransform(imgs);
                first_iter_gpu = false;
            }
            stitcher_gpu.composePanorama(imgs, pano);
        }
        else
        {
            if (first_iter_cpu)
            {
                stitcher_cpu.estimateTransform(imgs);
                first_iter_cpu = false;
            }
            stitcher_cpu.composePanorama(imgs, pano);
        }

        double proc_fps = getTickFrequency()  / (getTickCount() - proc_start);

        stringstream msg; msg << "total FPS = " << setprecision(4) << total_fps;
        printText(pano, msg.str(), 0);

        msg.str(""); msg << "processing FPS = " << setprecision(4) << proc_fps;
        printText(pano, msg.str(), 1);

        printText(pano, use_gpu ? "mode = GPU" : "mode = CPU", 2);

        imshow("stitching_demo", pano);

        processKey(waitKey(3) & 0xff);

        total_fps = getTickFrequency()  / (getTickCount() - proc_start);

        cout << endl;
    }
}
开发者ID:DiegoRider,项目名称:opencv_attic,代码行数:70,代码来源:stitching.cpp


注:本文中的Stitcher::setFeaturesMatcher方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。