#include <opencv2/objdetect.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/videoio.hpp>
#include <iostream>
#include <iomanip>
#include <opencv2/opencv.hpp>
#include <vector>
#include <opencv2/imgproc/types_c.h>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
Mat matArray[]={Mat(1,2,CV_32FC1,cv::Scalar(1)),Mat(1,2,CV_32FC1,cv::Scalar(2))};
Mat vout,hout;
vconcat(matArray,2,vout);
cout<<vout<<endl;
hconcat(matArray,2,hout);
cout<<hout<<endl;
Mat A=(cv::Mat_<float>(2,2)<<1,7,2,8);
Mat B=(cv::Mat_<float>(2,2)<<4,10,5,11);
Mat vC,hC;
vconcat(A,B,vC);
cout<<vC<<endl;
hconcat(A,B,hC);
cout<<hC<<endl;
Mat img00=imread("lena.png");
Mat img01=imread("lena.png");
Mat img10=imread("lena.png");
Mat img11=imread("lena.png");
Mat img,img0,img1;
hconcat(img00,img01,img0);
hconcat(img10,img11,img1);
vconcat(img0,img1,img);
imshow("img0",img0);
imshow("img1",img1);
imshow("img",img);
waitKey(0);
return 0;
}
实验结果: