Show multiple (2,3,4,…) images in the same window in OpenCV

后端 未结 6 1857
臣服心动
臣服心动 2020-12-13 07:11

I want to show 2, 3 or more images in the same window.

My problem is how to put the second, third image just on the right side (above, left or upper) the main image.

6条回答
  •  孤城傲影
    2020-12-13 07:42

    Try this code (see my comments):

    Mat img = imread("lena.JPG");
    
    CV::Mat chann[3], all; //  creating 
    
    split(img, chann); // split an image into their color channel and n keep them inside
    
    a 3 element array called chann
    
    imshow("ppl", img);
    
    hconcat(chann, 3, all); //  joining the images together in a horizontal manner, the 
    
    array, number of array, and the destination
    
    imshow("B :: G :: R",all);     // this just the little help i could provide 
    

提交回复
热议问题