how to display 2 images in one ? [closed]

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

begueradj gravatar image

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

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

I divide it into 2 pictures:

im1=im[0:199,0:99]
im2=im[200:399,0:99]

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

Comments

This is a duplicate: here is the answer

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-04-13 08:45:21 -0500 )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 -0500 )edit

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

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

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 -0500 )edit

@Guanta thank you very much. Your idea works fine

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