arr = np.arange(150).reshape(5, 10, 3)
x, y, z = arr.shape
indices = np.vstack(np.unravel_index(np.arange(x * y), (y, x))).T
np.hstack((arr.reshape(x * y, z), indices))
Convert an image to 2D array in python