CIE Luv#
Tip
Learn more: https://en.wikipedia.org/wiki/CIELUV
Functions#
- kornia.color.rgb_to_luv(image, eps=1e-12)[source]#
Convert an sRGB image to Luv.
luv = rgb_to_luv(image)converts a(*, 3, H, W)sRGB image in \([0, 1]\) to CIE Luv with the D65 white point and the 2° observer. L is in \([0, 100]\).
- Convention:
Float16 and bfloat16 inputs are computed in float32 and rounded to the input dtype at return. Channels are
L,u,vat axis -3. The sRGB curve is removed inside, so pass sRGB, not linear RGB. The scale is that of OpenCV’s float32 Luv, not of its 8-bit Luv, and the values match skimagergb2luv.
- Parameters:
- Return type:
- Returns:
Luv image with shape
(*, 3, H, W).
See also
luv_to_rgb(): the inverse.RgbToLuv: the module form, which has noepsand uses the default.
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 sRGB.
rgb = luv_to_rgb(image)converts a(*, 3, H, W)CIE Luv image with the D65 white point and the 2° observer to sRGB. L is expected in \([0, 100]\).- Convention:
Float16 and bfloat16 inputs are computed in float32 and rounded to the input dtype at return. Channels are
L,u,vat axis -3. The result is not clipped, so out-of-gamut Luv values give RGB values outside \([0, 1]\).
- Parameters:
- Return type:
- Returns:
sRGB image with shape
(*, 3, H, W).
See also
rgb_to_luv(): the inverse.LuvToRgb: the module form, which has noepsand uses the default.
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 sRGB to Luv (module form).
out = RgbToLuv()(image)isrgb_to_luv()with its defaulteps.- Convention:
See the convention block of
rgb_to_luv().
- Shape:
image:
(*, 3, H, W)output:
(*, 3, H, W)
See also
rgb_to_luv(): the one-call form, with anepsargument.LuvToRgb: the inverse.
Examples
>>> input = torch.rand(2, 3, 4, 5) >>> luv = RgbToLuv() >>> output = luv(input) # 2x3x4x5
References
[1] https://docs.opencv.org/4.0.1/de/d25/imgproc_color_conversions.html
- class kornia.color.LuvToRgb(*args, **kwargs)[source]#
Convert an image from Luv to sRGB (module form).
out = LuvToRgb()(image)isluv_to_rgb()with its defaulteps.- Convention:
See the convention block of
luv_to_rgb().
- Shape:
image:
(*, 3, H, W)output:
(*, 3, H, W)
See also
luv_to_rgb(): the one-call form, with anepsargument.RgbToLuv: the inverse.
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