Ask Your Question
1

image sampling and its implementation in opencv

asked 2017-02-22 11:40:32 -0600

surfreta gravatar image

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.

edit retag flag offensive close merge delete

Comments

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

berak gravatar imageberak ( 2017-02-22 12:26:51 -0600 )edit

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).

Eduardo gravatar imageEduardo ( 2017-02-23 04:39:43 -0600 )edit

1 answer

Sort by » oldest newest most voted
1

answered 2017-02-22 12:23:24 -0600

Well if you are using python, you can use "cv2.resize()"

subA = cv2.resize(A, (128,128), interpolation = cv2.INTER_AREA)

subA' = cv2.resize(A', (128,128), interpolation = cv2.INTER_AREA)

if both A,A' are same in dimension then both sub-sampled image will have same pixel operation on it

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-02-22 11:40:32 -0600

Seen: 3,450 times

Last updated: Feb 22 '17