nvidia.dali.fn.brightness_contrast(__input, /, *, brightness=1.0, brightness_shift=0.0, bytes_per_sample_hint=[0], contrast=1.0, contrast_center=0.5, dtype=None, preserve=False, seed=-1, device=None, name=None)#

Adjusts the brightness and contrast of the images.

The brightness and contrast are adjusted based on the following formula:

out = brightness_shift * output_range +
      brightness * (contrast_center + contrast * (in - contrast_center))

Where the output_range is 1 for float outputs or the maximum positive value for integral types.

This operator can also change the type of data.

This operator allows sequence inputs and supports volumetric data.

Supported backends
  • ‘cpu’

  • ‘gpu’


__input (TensorList ('FHWC', 'DHWC', 'HWC')) – Input to the operator.

Keyword Arguments:
  • brightness (float or TensorList of float, optional, default = 1.0) –

    Brightness multiplier.

    Supports per-frame inputs.

  • brightness_shift (float or TensorList of float, optional, default = 0.0) –

    The brightness shift.

    For signed types, 1.0 represents the maximum positive value that can be represented by the type.

    Supports per-frame inputs.

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