Reputation: 1134
Essentially, I have an array of images in the shape of [36, 107, 107, 3]. I want to reshape this batch of images so that the resulting array is one image of shape [642, 642, 3]. Everything that I have tried so far has resulted in the image being distorted. Any help is appreciated.
Upvotes: 0
Views: 165
Reputation: 1266
Note, this will not be efficient, but it can be accomplished with some iteration:
ims = np.ones(36, 107, 107, 3)
im_per_side = np.sqrt(ims.shape[0]).astype(int)
# Reshape so we have real axes with desired orientation of images.
ims = np.reshape(ims, [im_per_side, im_per_side, 107, 107, 3]
length_slices = []
for l in range(im_per_side):
height_slice = []
for h in range(im_per_side):
height_slice.append(ims[l, h])
length_slices.apppend(np.concatenate(im_layer, 1))
# Finally concatenate along the `length` axis.
final_ims = np.concatenate(length_slices, 0)
Upvotes: 1