CIE Luv#
Tip
Learn more: https://en.wikipedia.org/wiki/CIELUV
Functions#
- kornia.color.rgb_to_luv(image, eps=1e-12)[source]#
Convert a RGB image 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.
- Convention:
Input is nonlinear sRGB in RGB order at axis -3. Output is CIE L*u*v* with D65 / 2° reference white.
- Parameters:
image (
Tensor) – RGB Image to be converted to Luv with shape \((*, 3, H, W)\).eps (
float, optional) – for numerically stability when dividing. For float16 input a positiveepsbelow \(2^{-14}\), the smallest normal float16 value, is raised to it: smaller values underflow to zero or overflow the backward pass. Default:1e-12
- Return type:
- 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.
- Convention:
Input channels are CIE L*, u*, v* at axis -3 with D65 / 2° reference white. The result is nonlinear sRGB.
- Parameters:
image (
Tensor) – Luv image to be converted to RGB with shape \((*, 3, H, W)\).eps (
float, optional) – for numerically stability when dividing. For float16 input a positiveepsbelow \(2^{-14}\), the smallest normal float16 value, is raised to it: smaller values underflow to zero or overflow the backward pass. Default:1e-12
- Return type:
- 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.
See the Convention block on
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
- class kornia.color.LuvToRgb(*args, **kwargs)[source]#
Convert an image from Luv to RGB.
See the Convention block on
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