If we get two images, target image tgt_img
and source image src_img
. And, we also know the grid
grid
from source image to target image. Thus, we can use the F.grid_sample
to generate target image from source image.
tgt_img = F.grid_sample(src_img, grid)
Is there any good idea to get the inv_grid
that are from target image to source image. So that:
inv_grid = ?
src_img = F.grid_sample(tgt_img, inv_grid)
I have tried to read the data in grid and generate a inv_grid
, but I want to know if there any better and faster method.