使用其他numpy数组索引多维numpy数组

时间:2019-03-12 09:26:20

标签: python arrays numpy

我有一个(720,720,30)形状的数组。我们称它为A。这是一个720 * 720像素的图像,具有30个不同的图层。我要为所有30层图像取一些要点。因此,我还有另外两个形状为(22,)的numpy数组。我们称它们为b和c。现在,我想在所有图层中选择所有这些点。所以,我使用这样的代码:

Z = A [B, C, ...]

我希望Z是形状为(22、22、30)的数组。

运行代码时出现索引错误:

IndexError: arrays used as indices must be of integer (or boolean) type

如何解决此问题?预先感谢!

0 个答案:

没有答案