nvidia.dali.fn.experimental.warp_perspective#

nvidia.dali.fn.experimental.warp_perspective(
__input,
__matrix_gpu=None,
/,
*,
border_mode='constant',
bytes_per_sample_hint=[0],
fill_value=[],
interp_type=DALIInterpType.INTERP_LINEAR,
inverse_map=True,
matrix=[],
pixel_origin='corner',
preserve=False,
seed=-1,
size=[],
device=None,
name=None,
)#

Performs a perspective transform on the images.

Supported backends
  • ‘gpu’

Parameters:
  • __input (TensorList 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_gpu (1D TensorList of float, optional) – Transformation matrix data. Should be used to pass the GPU data. For CPU data, the matrix argument should be used.

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

  • bytes_per_sample_hint (int or list of int, optional, default = [0]) –

    Output size hint, in bytes per sample.

    If specified, the operator’s outputs residing in GPU or page-locked host memory will be preallocated to accommodate a batch of samples of this size.

  • 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 TensorList of float, optional, default = []) –

    Perspective transform mapping 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).)

  • preserve (bool, optional, default = False) – Prevents the operator from being removed from the graph even if its outputs are not used.

  • seed (int, optional, default = -1) –

    Random seed.

    If not provided, it will be populated based on the global seed of the pipeline.

  • size (float or list of float or TensorList 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).