本文实例为大家分享了opencv实现多张图像简单拼接,供大家参考,具体内容如下
#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; }
效果如下:
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
评论(0)