0

I have a 13 bands image and I want to iterate over each band, is there a way to get the image of each band using a for loop? I am trying with the following structure:

# image is [H, W, 13]
assert image.shape[2] == 13   # 3
#image = image[:, :, 0]  #  getting rid of 13
#plt.imshow(torch.clip((image) * 255, 0, 255).int())   # here is just messing with the image plotting, just change it by opencv environment and we'll get it
#plt.imshow(image)

fclip = torch.clip((image * imagenet_std + imagenet_mean) * 255, 0, 255)
fclip = fclip.int()   # 224, 224, 13

ima = 0

for i in fclip:
    ima = ima + fclip[i]
    plt.imshow(ima)
  • Does this answer your question? [Slicing 3d numpy arrays](https://stackoverflow.com/questions/28010860/slicing-3d-numpy-arrays) – relent95 Oct 27 '22 at 01:21

0 Answers0