Numpy: how to convert (256, 256) value image into (256, 256, 1) array of data points and back?
I have tried and what I want:
tX = np.random.rand(100, 256,256)
tXnew = np.empty((tX.shape) + (1,))
tXnew[:, :, :, 0] = tX
assert(tXnew[1,5,55,0] == tX[1,5, 55])
#tXrestored = ? from tXnew
#assert(tXrestored [1,5,55] == tX[1,5, 55])