How to downsample an image with interleaved output

I have an single-channel image with size 32x32. I want to down-sample it into 16x16 as 4 images or 1 image has four channels such that no pixel in the original 32x32 image is lost.

The four images or 4-channel image should have each pixel at the same location is interleaved with each other in the original image.

For example, below 4x4 image are downscaled into 4 2x2 images. Each number represents the new image index.

1 2 1 2 1 2 1 2 1 2
3 4 3 4 3 4 3 4 3 4
1 2 1 2 1 2 1 2 1 2
3 4 3 4 3 4 3 4 3 4
1 2 1 2 1 2 1 2 1 2
3 4 3 4 3 4 3 4 3 4
1 2 1 2 1 2 1 2 1 2
3 4 3 4 3 4 3 4 3 4

1 Like

Hi! I’m doing the same… Did you find an efficient solution? Im currently indexing and concatenating which feels expensive, given the fact this is a form of reshape…