opencv图像二合一并排显示

#include  
#include  
#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);
}
 

你可能感兴趣的:(opencv3)