# image sampling and its implementation in opencv

I have a set of image pairs, i.e., `{A, A’}, {B, B’}, {C,C’}`

etc.

Given an image `A`

, for instance, `256*256`

, are there any sampling mechanisms to generate a small image, i.e., `128*128`

, that can capture the global contexts of original images.

At the same time, I would like to keep track information of those sampled pixels. For instance, if `pixel[I,J]`

in `A`

is selected, I need to track it because I need to select the same pixel of `A’`

.

In other words, I need to generate a set of smaller image pairs based on these large image pairs. The sampling mechanism, however, is based on `A, B, C,`

etc.

hey, i've read this for 3 times, still no idea, what you're actually asking.

Use a nearest neighbor algorithm for resizing and store in another matrix the original coordinate. For instance: pixel a at coordinate (100,100), when downsampling by a factor of 2, the corresponding pixel is a' at coordinate (50,50). So in another matrix, in the coordinate (50,50) you will store (100,100).