← Back to all transforms

RandomBrightnessContrast

Description

Randomly change brightness and contrast of the input image.

    Args:
        brightness_limit: factor range for changing brightness.
            If limit is a single float, the range will be (-limit, limit). Default: (-0.2, 0.2).
        contrast_limit: factor range for changing contrast.
            If limit is a single float, the range will be (-limit, limit). Default: (-0.2, 0.2).
        brightness_by_max: If True adjust contrast by image dtype maximum,
            else adjust contrast by image mean.
        p: probability of applying the transform. Default: 0.5.

    Targets:
        image

    Image types:
        uint8, float32

    

Parameters

  • p: float (default: 0.5)
  • brightness_limit: int | tuple[int, int] | float | tuple[float, float] (default: (-0.2, 0.2))
  • contrast_limit: int | tuple[int, int] | float | tuple[float, float] (default: (-0.2, 0.2))
  • brightness_by_max: bool (default: true)

Targets

  • Image

Try it out

Original Image (width = 484, height = 733):

Original

Transformed Image:

Transform not yet applied