CIE Luv#

Functions#

kornia.color.rgb_to_luv(image, eps=1e-12)[source]#

Convert a RGB image to Luv.

_images/rgb_to_luv.png

The image data is assumed to be in the range of \([0, 1]\). Luv color is computed using the D65 illuminant and Observer 2.

Parameters:
  • image (Tensor) – RGB Image to be converted to Luv with shape \((*, 3, H, W)\).

  • eps (float, optional) – for numerically stability when dividing. Default: 1e-12

Return type:

Tensor

Returns:

Luv version of the image with shape \((*, 3, H, W)\).

Example

>>> input = torch.rand(2, 3, 4, 5)
>>> output = rgb_to_luv(input)  # 2x3x4x5
kornia.color.luv_to_rgb(image, eps=1e-12)[source]#

Convert a Luv image to RGB.

Parameters:
  • image (Tensor) – Luv image to be converted to RGB with shape \((*, 3, H, W)\).

  • eps (float, optional) – for numerically stability when dividing. Default: 1e-12

Return type:

Tensor

Returns:

Luv version of the image with shape \((*, 3, H, W)\).

Example

>>> input = torch.rand(2, 3, 4, 5)
>>> output = luv_to_rgb(input)  # 2x3x4x5

Modules#

class kornia.color.RgbToLuv(*args, **kwargs)[source]#

Convert an image from RGB to Luv.

The image data is assumed to be in the range of \([0, 1]\). Luv color is computed using the D65 illuminant and Observer 2.

Returns:

Luv version of the image.

Shape:
  • image: \((*, 3, H, W)\)

  • output: \((*, 3, H, W)\)

Examples

>>> input = torch.rand(2, 3, 4, 5)
>>> luv = RgbToLuv()
>>> output = luv(input)  # 2x3x4x5
Reference:

[1] https://docs.opencv.org/4.0.1/de/d25/imgproc_color_conversions.html

[2] https://www.easyrgb.com/en/math.php

[3] http://www.poynton.com/ColorFAQ.html

class kornia.color.LuvToRgb(*args, **kwargs)[source]#

Convert an image from Luv to RGB.

Returns:

RGB version of the image.

Shape:
  • image: \((*, 3, H, W)\)

  • output: \((*, 3, H, W)\)

Examples

>>> input = torch.rand(2, 3, 4, 5)
>>> rgb = LuvToRgb()
>>> output = rgb(input)  # 2x3x4x5

References

[1] https://docs.opencv.org/4.0.1/de/d25/imgproc_color_conversions.html

[2] https://www.easyrgb.com/en/math.php

[3] http://www.poynton.com/ColorFAQ.html