HLS#
Tip
Learn more: https://en.wikipedia.org/wiki/HSL_and_HSV
Functions#
- kornia.color.rgb_to_hls(image, eps=1e-8)[source]#
Convert an RGB image to HLS.
The image data is assumed to be in the range of (0, 1).
NOTE: this method cannot be compiled with JIT in pytohrch < 1.7.0
- Parameters:
- Return type:
- Returns:
HLS version of the image with shape \((*, 3, H, W)\).
Example
>>> input = torch.rand(2, 3, 4, 5) >>> output = rgb_to_hls(input) # 2x3x4x5
- kornia.color.hls_to_rgb(image)[source]#
Convert a HLS image to RGB.
The image data is assumed to be in the range of (0, 1).
- Parameters:
image (
Tensor) – HLS image to be converted to RGB with shape \((*, 3, H, W)\).- Return type:
- Returns:
RGB version of the image with shape \((*, 3, H, W)\).
Example
>>> input = torch.rand(2, 3, 4, 5) >>> output = hls_to_rgb(input) # 2x3x4x5
Modules#
- class kornia.color.RgbToHls(*args, **kwargs)[source]#
Convert an image from RGB to HLS.
The image data is assumed to be in the range of (0, 1).
- Returns:
HLS version of the image.
- Shape:
image: \((*, 3, H, W)\)
output: \((*, 3, H, W)\)
Examples
>>> input = torch.rand(2, 3, 4, 5) >>> hls = RgbToHls() >>> output = hls(input) # 2x3x4x5
- class kornia.color.HlsToRgb(*args, **kwargs)[source]#
Convert an image from HLS to RGB.
The image data is assumed to be in the range of (0, 1).
- Returns:
RGB version of the image.
- Shape:
input: \((*, 3, H, W)\)
output: \((*, 3, H, W)\)
- Reference:
Examples
>>> input = torch.rand(2, 3, 4, 5) >>> rgb = HlsToRgb() >>> output = rgb(input) # 2x3x4x5