how to display 2 images in one ? [closed]

asked 2015-04-13 08:34:11 -0600

begueradj gravatar image

updated 2015-04-13 08:40:55 -0600

I read an image: im=cv2.imread('image.jpg')

I divide it into 2 pictures:


I display im1 and im2 separately. It is ok.

But now, I want to save im1 and im2 in combine and display combine which must display me the same image as im. How can I fulfill this ?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2016-01-04 23:21:16.986122


This is a duplicate: here is the answer

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-04-13 08:45:21 -0600 )edit

@thdrksdfthmn thank you. In fact I have 4 blocks of the same image, all of them with the same size. Can I use push_back in this case too ?

begueradj gravatar imagebegueradj ( 2015-04-13 08:51:39 -0600 )edit

@thdrksdfthmn I tried but the push_back does not exist in Python/numpy

begueradj gravatar imagebegueradj ( 2015-04-13 08:54:02 -0600 )edit

Use np.hstack, np.vstack or np.concatenate, e.g. np.concatenate( [im1,im2], axis=1).

Guanta gravatar imageGuanta ( 2015-04-13 08:57:42 -0600 )edit

@Guanta thank you very much. Your idea works fine

begueradj gravatar imagebegueradj ( 2015-04-13 09:04:25 -0600 )edit