Hello,
I have a set of 3 channel (RGB) 512x512 images with a batch size of 17, stored in a tensor of shape (17, 3, 512, 512).
I also have a series of 2D lookup co-ordinates in a tensor of shape (17, 512, 512, 2), where that final 2 is the XY coordinate of the pixel to look up a source pixel in the original image, allowing me to rearrange the pixels of the 17 source images into 17 new resulting images.
Thanks to some help from this forum, I had this ‘2D pixel lookup’ working when I had a single 2D source image, which also was grayscale, so my image tensor was just (512, 512) and the ‘2d lookup co-ordinates’ tensor was (512, 512, 2). The line that made that work was:
new_images = orig_images[..., lookup_coords[:, :, 0], lookup_coords[:, :, 1]]
But now I have 3 channels in my image and a batch size of 17, this line produces a resulting shape of (17, 3, 17, 512, 2) instead of (17, 3, 512, 512) - which matches the input textures - as I wanted.
I’ve messed with that line a lot, and tried squeezing and unsqueezing various items, but I just can’t get the right output shape. Can anyone help? Thanks if you can.
p.s. In case the above wasn’t clear, the 17 input images each have their own unique 2D lookup coordinate maps