Concatenating images (numpy arrays), but they look like HSV images

Sebastian Schabe sebastian.schabe at gmx.de
Thu Jul 9 13:34:59 EDT 2009


Hello everybody,

I want to concatenate 2 numpy array which in fact are RGB images:

def concat_images(im1,im2):
   rows1 = im1.shape[0]
   rows2 = im2.shape[0]

   if rows1 < rows2:
     im1 = concatenate((im1,zeros((rows2-rows1,im1.shape[1],3), int)), 
axis=0)
   elif rows1 > rows2:
     im2 = concatenate((im2,zeros((rows1-rows2,im2.shape[1],3), int)), 
axis=0)

   return concatenate((im1,im2), axis=1)

It's all working fine, except that the images when showing with pylab 
are somewhat interpreted as HSV images as it looks. The function zeros() 
must be responsible for that circumstance, because when the arrays have 
the same shape and are concatenated they appear as horizontally 
concatenated images as I expected.

Can someone help me with that?

Thanks a lot,
Basti



More information about the Python-list mailing list