ausk
 

调用opencv2.4.6中的库函数,实现图像的拼接功能,傻瓜式拼接,不需要太多的专业知识。。。

 

 1 #include "stdafx.h"
 2 #include <iostream>
 3 #include <opencv2/core/core.hpp>
 4 #include <opencv2/highgui/highgui.hpp>
 5 #include <opencv2/imgproc/imgproc.hpp>
 6 #include <opencv2/stitching/stitcher.hpp>
 7 using namespace std;
 8 using namespace cv;
 9 bool try_use_gpu = false;
10 vector<Mat> imgs;
11 string result_name = "result.jpg";
12 int _tmain(int argc, char * argv[])
13 {
14     Mat img1 = imread("1.jpg");
15     Mat img2 = imread("2.jpg");
16     Mat img3 = imread("3.jpg");    
17     Mat img4 = imread("4.jpg");    
18     if (img1.empty() || img2.empty())
19     {
20         cout << "Can\'t read image"<< endl;
21         return -1;
22     }
23     imgs.push_back(img1);
24     imgs.push_back(img2);
25     imgs.push_back(img3);
26     imgs.push_back(img4);
27     Stitcher stitcher = Stitcher::createDefault(try_use_gpu);
28     // 使用stitch函数进行拼接
29     Mat pano;
30     Stitcher::Status status = stitcher.stitch(imgs, pano);
31     imwrite(result_name, pano);
32     Mat pano2=pano.clone();
33     // 显示源图像,和结果图像
34     imshow("全景图像", pano);
35     if(waitKey()==27)
36         return 0;
37 }

 

opencv实现全景图拼接

 

 

分类:

技术点:

相关文章:

  • 2021-09-25
  • 2021-09-25
  • 2021-09-23
  • 2021-10-05
  • 2021-09-25
  • 2021-07-13
  • 2021-09-25
猜你喜欢
  • 2021-10-05
  • 2021-09-25
  • 2021-09-25
  • 2021-09-25
  • 2021-09-28
  • 2021-09-25
  • 2021-09-25
相关资源
相似解决方案