Getting images from a 3D numpy array of images using an array of indexes

Viewed 14

I have 500 10x10 images in a numpy array of shape (10,10,500) and I want to take out images from some indexes which I have saved in a numpy array. For example indexes = array([201, 203, 208]) out of the 500.

images.shape # (10,10,500)

I found out that I can do images[...,200] to get the 200th image, but can I do that automatically for the whole array of indexes or do i need to have a for loop over indexes and append them one by one to a new array?

0 Answers
Related