opencv图像二合一并排显示

#include <iostream>  
#include <fstream>  
#include "opencv2/highgui/highgui.hpp"  
#include "opencv2/stitching/stitcher.hpp"  
 
using namespace std;
using namespace cv;
 
void main()
{
    Mat image_one = imread("1.jpg");  //
    Mat image_two = imread("2.jpg");  //
    Mat result(image_one.rows, image_one.cols +
        image_two.cols, image_one.type());

    image_one.colRange(0, image_one.cols).
        copyTo(result.colRange(0, image_one.cols));
 
    image_two.colRange(0, image_two.cols).copyTo(
       result.colRange(image_one.cols, result.cols));
    imwrite("result.jpg",result);
    waitKey(0);
}
 

猜你喜欢

转载自blog.csdn.net/hankerbit/article/details/82119908