I want to combine two images of different channel:
import numpy as np
from PIL import Image
list_im = ['1.png', '2.png']
imgs = [ Image.open(i) for i in list_im ]
min_shape = sorted( [(np.sum(i.size), i.size ) for i in imgs])[0][1]
imgs_comb = np.vstack( (np.asarray( i.resize(min_shape) ) for i in imgs ) )
imgs_comb = Image.fromarray( imgs_comb)
imgs_comb.save( '3.png' )
##imgs_comb = np.hstack( (np.asarray( i.resize(min_shape) ) for i in imgs ) )
##imgs_comb = Image.fromarray( imgs_comb)
##imgs_comb.save( '4.png' )
Output:
return _nx.concatenate([atleast_2d(_m) for _m in tup], 0)
ValueError: all the input arrays must have same number of dimensions
Is it possible to first combine them and then save them in one image and keep their base "color" (grayscale and 3 channel)?