• 图像拼接 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;
    }
  • 相关阅读:
    c# 自定义位数生成激活码
    接口interface和抽象类型abstract
    winform自动升级方案
    泛型介绍
    泛型约束形式
    登录状态保持Session/Cookie
    EFCore 2.0引用标量函数
    .net生成条形码
    通用手机号、身份证号等隐藏显示方法
    .net core api Post请求
  • 原文地址:https://www.cnblogs.com/hsy1941/p/14505371.html
Copyright © 2020-2023  润新知