Bilinear sampler

I want to do something like this:

Inputs are input_image of size 1x1x256x512 and offset of size 1x1x256x512. I need to sample input_image and move each pixel in x direction according to offset.

Can I use torch.nn.functional.grid_sample? If yes, how? Any suggestion is highly appreciated.

1 Like

did you find your answer? so please share

You could adjust the following code that performs backward-warping for optical flow.

Disparity is essentially just optical flow without vertical motion.

1 Like

@sniklaus solutiuon looks great.

Take a look at my repo too here