How do I re-shape an array with shape(band,row,column) to (row,column,band)?

后端 未结 2 1862
傲寒
傲寒 2021-01-26 21:06

I have a NumPy array with shape(370,275,210) and I want to re-shape it to (275,210,370). How would I achieve this in Python? 370 is the number of bands,275 is the number of rows

2条回答
  •  伪装坚强ぢ
    2021-01-26 21:17

    Actually, I suppose that you need to swap the axis 0 with 2.

    np.swapaxes(x, 0, 2)
    

    That is probably an hyperspectral image?

提交回复
热议问题