Warping an image with an optical flow¶

warp_fn(x: Tensor, flow: Tensor) Tensor[source]¶

Motion compensation (warping) of a tensor [B, C, H, W] with a 2-d displacement [B, 2, H, W].

Parameters:
  • x (Tensor) – Tensor to be motion compensated [B, C, H, W].

  • flow (Tensor) – Displacement [B, C, H, W]. flow[:, 0, :, :] corresponds to the horizontal displacement. flow[:, 1, :, :] is the vertical displacement.

Returns:

Motion compensated tensor [B, C, H, W].

Return type:

Tensor