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:
Float16 and bfloat16 inputs are computed in float32 and rounded to the input dtype at return. Input is nonlinear sRGB in RGB order at axis -3. Output is CIE L*u*v* with D65 / 2° reference white.
- Parameters:
- 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:
Float16 and bfloat16 inputs are computed in float32 and rounded to the input dtype at return. Input channels are CIE L*, u*, v* at axis -3 with D65 / 2° reference white. The result is nonlinear sRGB.
- Parameters:
- 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