nvidia.dali.fn.contrast

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

Adjusts the contrast of the images.

The contrast is adjusted based on the following formula:

out = contrast_center + contrast * (in - contrast_center)

This operator can also change the type of data.

This operator allows sequence inputs and supports volumetric data.

Supported backends
  • ‘cpu’

  • ‘gpu’

Parameters:

input (TensorList ('FHWC', 'DHWC', 'HWC')) – 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.

  • contrast (float or TensorList of float, optional, default = 1.0) –

    The contrast multiplier, where 0.0 produces the uniform grey.

    Supports per-frame inputs.

  • contrast_center (float or TensorList of float, optional, default = 0.5) –

    The intensity level that is unaffected by contrast.

    This is the value that all pixels assume when the contrast is zero. When not set, the half of the input type’s positive range (or 0.5 for float) is used.

    Supports per-frame inputs.

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

    Output data type.

    If not set, the input type is used.

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