Efficiently Reshaping/Reordering Numpy Array to Properly Ordered Tiles (Image)
- by Phelix
I would like to be able to somehow reorder a numpy array for efficient processing of tiles.
what I got:
>>> A = np.array([[1,2],[3,4]]).repeat(2,0).repeat(2,1)
>>> A # image like array
array([[[1, 1, 2, 2],
[1, 1, 2, 2]],
[[3, 3, 4, 4],
[3, 3, 4, 4]]])
>>> A.reshape(2,2,4)
array([[[1, 1, 2, 2],…