Sepia#

Functions#

kornia.color.sepia(input, rescale=True, eps=1e-6)[source]#

Apply the sepia filter to an RGB tensor.

Convention:

Applies the fixed sepia matrix to RGB channels at axis -3. rescale divides all output channels of each image by one shared maximum over channels and pixels, preserving the tint. Disable it to keep the raw matrix response.

Parameters:
  • input (Tensor) – the input tensor with shape \((*, C, H, W)\).

  • rescale (bool, optional) – if True, divide all output channels by one maximum per image. Default: True

  • eps (float, optional) – small constant added to the denominator for numerical stability. Default: 1e-6

Returns:

sepia-filtered tensor with shape \((*, C, H, W)\).

Return type:

torch.Tensor

Example

>>> input = torch.ones(3, 1, 1)
>>> sepia_from_rgb(input, rescale=False)
tensor([[[1.3510]],

        [[1.2030]],

        [[0.9370]]])

Modules#

class kornia.color.Sepia(rescale=True, eps=1e-6)[source]#

Apply the sepia filter to image tensors.

See the Convention block on sepia_from_rgb().

Parameters:
  • rescale (bool, optional) – if True, divide all output channels by one maximum per image. Default: True

  • eps (float, optional) – small constant added to the denominator for numerical stability. Default: 1e-6

Returns:

sepia-filtered tensor with shape \((*, C, H, W)\).

Return type:

torch.Tensor

Example

>>> input = torch.ones(3, 1, 1)
>>> Sepia(rescale=False)(input)
tensor([[[1.3510]],

        [[1.2030]],

        [[0.9370]]])