opencv实现多张图像拼接 opencv实现多张图像拼接

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

opencv实现多张图像拼接 opencv实现多张图像拼接

frank95804   2021-03-30 我要评论

#include <iostream>
#include <core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include<opencv2/stitching.hpp>
 
using namespace std;
using namespace cv;
int main()
{
 
 Mat combine, combine1, combine2;
 Mat a = imread("idol1.jpg");
 Mat b = imread("idol2.jpg");
 Mat c = imread("idol3.jpg");
 Mat d = imread("idol4.jpg");
 
 cv::resize(a, a, cv::Size(100, 100), 0, 0, CV_INTER_LINEAR);
 cv::resize(b, b, cv::Size(100, 100), 0, 0, CV_INTER_LINEAR);
 cv::resize(c, c, cv::Size(100, 100), 0, 0, CV_INTER_LINEAR);
 cv::resize(d, d, cv::Size(100, 100), 0, 0, CV_INTER_LINEAR);
 //水平拼接
 hconcat(a, b, combine1);
 hconcat(c, d, combine2);
 
 //垂直拼接
 vconcat(combine1, combine2, combine);
 namedWindow("Combine", CV_WINDOW_AUTOSIZE);
 imshow("Combine", combine);
 cv::waitKey(1);
 
 system("pause");
 return 0;
}

效果如下:

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们