nvidia.dali.fn.warp_affine(*inputs, **kwargs)

Applies an affine transformation to the images.

This operator supports volumetric data.

Supported backends
  • ‘cpu’

  • ‘gpu’

  • input0 (TensorList ('HWC', 'FHWC', 'DHWC', 'FDHWC')) – Input to the operator.

  • input1 (TensorList, optional) – Input to the operator.

Keyword Arguments
  • 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.

  • dtype (nvidia.dali.types.DALIDataType, optional) –

    Output data type.

    If not set, the input type is used.

  • fill_value (float, optional) –

    Value used to fill areas that are outside the source image.

    If a value is not specified, the source coordinates are clamped and the border pixel is repeated.

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

  • inverse_map (bool, optional, default = True) – Set to False if the given transform is a destination to source mapping, True otherwise.

  • matrix (float or list of float or TensorList of float, optional, default = []) –

    Transform matrix.

    When the inverse_map option is set to true (default), the matrix represents a destination to source mapping. With a list of values (M11, M12, M13, M21, M22, M23), this operation produces a new image by using the following formula:

    dst(x,y) = src(M11 * x + M12 * y + M13, M21 * x + M22 * y + M23)

    Where [0, 0] coordinate means the corner of the first pixel.

    If the inverse_map option is set to false, the matrix represents a source to destination transform and it is inverted before applying the formula above.

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

    Supports per-frame inputs.

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

    Non-integer sizes are rounded to nearest integer. The channel dimension should be excluded (for example, for RGB images, specify (480,640), not (480,640,3).

  • output_dtype (nvidia.dali.types.DALIDataType) –


    The argument output_dtype is a deprecated alias for dtype. Use dtype instead.