OpenCV中stitcher的简单应用

来源:互联网 发布:数据采集功能 编辑:程序博客网 时间:2024/06/15 20:08

OpenCV中stitcher的简单应用,利用opencv中自带的sample稍微改编。

#include <iostream>#include <fstream>#include "opencv2/highgui/highgui.hpp"#include "opencv2/stitching/stitcher.hpp"using namespace std;using namespace cv;vector<Mat> imgs;string result_name = "E://image1-2.jpg";int main(int argc, char* argv[]){Mat img1 = imread("E://image1.jpg");Mat img2 = imread("E://image2.jpg");imgs.push_back(img1);imgs.push_back(img2);    Mat pano;    Stitcher stitcher = Stitcher::createDefault();    Stitcher::Status status = stitcher.stitch(imgs, pano);    if (status != Stitcher::OK)    {        cout << "Can't stitch images, error code = " << status << endl;        return -1;    }    imwrite(result_name, pano);    return 0;}




原创粉丝点击