I have an numpy array of shape (780,256,256)
representing 780 tiles of an image, which I need to reassemble into the original image, but can't figure out how to reshape this properly.
The 780 tiles should be arranged in a grid 26x30 grid, so the end result has shape (6656, 7680)
. The tiles are in order as the image goes left to right, top to bottom.
I can get the tiles in a line by using np.hstack
on the array, and the first row correctly using row1 = np.hstack(array_of_tiles[0:30,:,:])
, but any reshaping I then do doesn't maintain the tile structure.
I can probably write out the tiles to tif and mosaic using QGIS but what is the correct way using numpy directly?