I'm reading someone's transform.py, and there is a code which really confuses me. Here it is:
np.concatenate(img_group, axis=2)
however, the img_group
here is a sequence of <class 'PIL.Image.Image'>
, and I've looked through the docs of np.concatenate(), it tells me that:enter link description here
numpy.concatenate((a1, a2, ...), axis=0, out=None) Join a sequence of arrays along an existing axis. Parameters: a1, a2, … : sequence of array_like The arrays must have the same shape, except in the dimension corresponding to axis (the first, by default).
and I have tried some samples like:
x = Image.open('flows/v_ApplyEyeMakeup_g08_c01/frame/img_00001.jpg').convert('RGB')
y = Image.open('flows/v_ApplyEyeMakeup_g08_c01/frame/img_00002.jpg').convert('RGB')
z = np.concatenate([x,y], axis=2)
then it worked! the z
is a numpy.ndarray
type whose size is (240,320,6). However, the <class 'PIL.Image.Image'>
seems not the kinds of array
that the np.concatenate()
parameters need, so I wonder how it works?