nvidia.dali.experimental.dynamic.experimental.warp_perspective#

nvidia.dali.experimental.dynamic.experimental.warp_perspective(input, matrix_input=None, /, *, batch_size=None, device=None, border_mode=None, fill_value=None, interp_type=None, inverse_map=None, matrix=None, pixel_origin=None, size=None)#

Performs a perspective transform on the images.

Supported backends
  • ‘cpu’

  • ‘gpu’

Parameters:
  • input (Tensor/Batch of uint8, uint16, int16 or float ('HW', 'HWC', 'FHWC', 'CHW', 'FCHW')) – Input data. Must be images in HWC or CHW layout, or a sequence of those.

  • matrix_input (2D Tensor/Batch of float, optional) – 3x3 Perspective transform matrix for per sample homography, same device as input.

Keyword Arguments:
  • border_mode (str, optional, default = ‘constant’) – Border mode to be used when accessing elements outside input image. Supported values are: “constant”, “replicate”, “reflect”, “reflect_101”, “wrap”.

  • fill_value (float or list of float, optional, default = []) – Value used to fill areas that are outside the source image when the “constant” border_mode is chosen.

  • interp_type (nvidia.dali.types.DALIInterpType, optional, default = DALIInterpType.INTERP_LINEAR) – Type of interpolation used.

  • inverse_map (bool, optional, default = True) – If set to true (default), the matrix is interpreted as destination to source coordinates mapping. Otherwise it’s interpreted as source to destination coordinates mapping.

  • matrix (float or list of float or Tensor/Batch of float, optional, default = []) –

    3x3 Perspective transform matrix of destination to source coordinates.

    If inverse_map argument is set to false, the matrix is interpreted as a source to destination coordinates mapping.

    It is equivalent to OpenCV’s warpPerspective operation with the inverse_map argument being analog to the WARP_INVERSE_MAP flag.

    Note

    Instead of this argument, the operator can take a second positional input, in which case the matrix can be placed on the GPU.

    Supports per-frame inputs.

  • pixel_origin (str, optional, default = ‘corner’) –

    Pixel origin. Possible values: “corner”, “center”.

    Determines the meaning of (0, 0) coordinates - “corner” places the origin at the top-left corner of the top-left pixel (like in OpenGL); “center” places (0, 0) in the center of the top-left pixel (like in OpenCV).)

  • size (float or list of float or Tensor/Batch of float, optional, default = []) –

    Output size, in pixels/points.

    The channel dimension should be excluded (for example, for RGB images, specify (480,640), not (480,640,3).