zoukankan      html  css  js  c++  java
  • 图像拼接 Stitcher

    // mycv.cpp : 定义控制台应用程序的入口点。
    //
    
    #include "mycv.h"
    #include <iostream>  
    #include <fstream>  
    #include <string>  
    #include "opencv2/opencv_modules.hpp"  
    #include "opencv2/highgui/highgui.hpp"  
    #include "opencv2/stitching.hpp"
    using namespace std;
    using namespace cv;
    using namespace cv::detail;
    
    int main()
    {
        vector<Mat> imgs;    //输入9幅图像
        Mat img;
        img = imread("./pic/1.jpg");
        imgs.push_back(img);
        //img = imread("./pic/2.jpg");
        //imgs.push_back(img);
        img = imread("./pic/3.jpg");
        imgs.push_back(img);
        //img = imread("./pic/4.jpg");
        //imgs.push_back(img);
        //img = imread("./pic/5.jpg");
        //imgs.push_back(img);
        
    
        int num_images = 5;
    
        Mat pano;    //全景图像
        Stitcher::Mode mode = Stitcher::SCANS;
        Ptr<Stitcher> stitcher = Stitcher::create(mode, false);//定义全景图像拼接器
        Stitcher::Status status = stitcher->stitch(imgs, pano);//图像拼接
        if (status != Stitcher::OK)
        {
            cout << "Can't stitch images, error code = " << int(status) << endl;
            return -1;
        }
    
        imwrite("pano.jpg", pano);    //存储图像
        return 0;
    }
  • 相关阅读:
    计划任务
    Crontab 定时任务格式参数
    Nginx 内核优化
    AC自动机
    Benelux Algorithm Programming Contest 2017(D)
    BAPC2017
    2018.9青岛网络预选赛(K)
    2018.9青岛网络预选赛
    2018.9青岛网络预选赛(A)
    2018.9青岛网络预选赛(C)
  • 原文地址:https://www.cnblogs.com/hsy1941/p/14505371.html
Copyright © 2011-2022 走看看