Hi, i am trying to generating joined images with two or three individual images . so, i am reading the individual images from the same folder which contains 200840 images of handwritten Bangla characters . but i am having issue with reading the images simultaneously and joining them . here i have attached me code . its showing error like
Cannot understand given URI: ['Train_169700.png', 'Train_66828.png', 'Train_123835.png....
def get_concat_h_resize(im1, im2, resample=Image.BICUBIC, resize_big_image=True):
if im1.height == im2.height:
_im1 = im1
_im2 = im2
elif (((im1.height > im2.height) and resize_big_image) or
((im1.height < im2.height) and not resize_big_image)):
_im1 = im1.resize((int(im1.width * im2.height / im1.height), im2.height), resample=resample)
_im2 = im2
else:
_im1 = im1
_im2 = im2.resize((int(im2.width * im1.height / im2.height), im1.height), resample=resample)
dst = Image.new('RGB', (_im1.width + _im2.width, _im1.height))
dst.paste(_im1, (0, 0))
dst.paste(_im2, (_im1.width, 0))
return ds
train_data_path = os.path.join(data_path, 'train_images128')
images = os.listdir(train_data_path)
train_dir = '../input/resized128shapna/train_images128'
images1 = images[1::2]
images2= images[::2]
h= 64
w= 64
x_train = np.zeros((len(images1), h, w), dtype=np.uint8)
index = 0
for x in range(len(images1)):
image1 = imread(os.path.join(train_dir, images1[x]))
image2 = imread(os.path.join(train_dir, images2[x]))
joined = get_concat_h_resize(image1,image2)
x_train[index] = joined
index += 1
imshow(y_train[0])