Issue
I have converted the image into a NumPy array. Then uses np.rot90 to rotate the array to 90 degrees.
img90 = np.array(np.rot90(image))
img90.shape
The output I receive is --> (256, 4, 256) But I want it to be (4, 256, 256)
I have tried
img90 = np.rollaxis(img90, 1, 0)
img90.shape
But the output is not fixed, sometimes it gives (256, 4,256) and sometimes (4, 256, 256)
Solution
You should specify the axes axes
and number of rotation k
parameters
assuming your array size is 256x256x4
:
img0 = np.rot90(img0, axes=(0,2), k= 1)
print(img0.shape)
>>> (4, 256, 256)
Answered By - Mohamadali Mahmoodpour
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.