I have an image as a numpy array with shape (channels, height, width)
how can I reshape it so that it has shape (height, width, channels)
?
I assume it would be quicker to use the built-in numpy function.
np.rollaxis(array_name,0,3).shape
You can use transpose()
to choose the order of the axes. In this case you want:
array.transpose(1, 2, 0)
This creates a new view onto the original array whenever possible (no data will be copied).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With