RGB#
Tip
Learn more: https://en.wikipedia.org/wiki/RGB_color_model
Functions#
- kornia.color.rgb_to_bgr(image)[source]#
Convert a RGB image to BGR.
- Parameters:
image (
Tensor) – RGB Image to be converted to BGRof of shape \((*,3,H,W)\).- Return type:
- Returns:
BGR version of the image with shape of shape \((*,3,H,W)\).
Example
>>> input = torch.rand(2, 3, 4, 5) >>> output = rgb_to_bgr(input) # 2x3x4x5
- kornia.color.rgb_to_rgb255(image)[source]#
Convert an image from RGB to RGB [0, 255] for visualization purposes.
- Parameters:
image (
Tensor) – RGB Image to be converted to RGB [0, 255] of shape \((*,3,H,W)\).- Return type:
- Returns:
RGB version of the image with shape of shape \((*,3,H,W)\).
Example
>>> input = torch.rand(2, 3, 4, 5) >>> output = rgb_to_rgb255(input) # 2x3x4x5
- kornia.color.rgb255_to_rgb(image)[source]#
Convert an image from RGB [0, 255] to RGB for visualization purposes.
- Parameters:
image (
Tensor) – RGB Image to be converted to RGB of shape \((*,3,H,W)\).- Return type:
- Returns:
RGB version of the image with shape of shape \((*,3,H,W)\).
Example
>>> input = torch.rand(2, 3, 4, 5) >>> output = rgb255_to_rgb(input) # 2x3x4x5
- kornia.color.rgb255_to_normals(image)[source]#
Convert an image from RGB [0, 255] to surface normals for visualization purposes.
- Parameters:
image (
Tensor) – RGB Image to be converted to surface normals of shape \((*,3,H,W)\).- Return type:
- Returns:
surface normals version of the image with shape of shape \((*,3,H,W)\).
Example
>>> input = torch.rand(2, 3, 4, 5) >>> output = rgb255_to_normals(input) # 2x3x4x5
- kornia.color.normals_to_rgb255(image)[source]#
Convert surface normals to RGB [0, 255] for visualization purposes.
- Parameters:
image (
Tensor) – surface normals to be converted to RGB with quantization of shape \((*,3,H,W)\).- Return type:
- Returns:
RGB version of the image with shape of shape \((*,3,H,W)\).
Example
>>> input = torch.rand(2, 3, 4, 5) >>> output = normals_to_rgb255(input) # 2x3x4x5
Modules#
- class kornia.color.RgbToBgr(*args, **kwargs)[source]#
Convert an image from RGB to BGR.
The image data is assumed to be in the range of (0, 1).
- Returns:
BGR version of the image.
- Shape:
image: \((*, 3, H, W)\)
output: \((*, 3, H, W)\)
Example
>>> input = torch.rand(2, 3, 4, 5) >>> bgr = RgbToBgr() >>> output = bgr(input) # 2x3x4x5
- class kornia.color.RgbToRgb255(*args, **kwargs)[source]#
Convert an image from RGB to RGB [0, 255] for visualization purposes.
- Returns:
RGB version of the image.
- Shape:
image: \((*, 3, H, W)\)
output: \((*, 3, H, W)\)
Example
>>> input = torch.rand(2, 3, 4, 5) >>> rgb = RgbToRgb255() >>> output = rgb(input) # 2x3x4x5
- class kornia.color.Rgb255ToRgb(*args, **kwargs)[source]#
Convert an image from RGB [0, 255] to RGB for visualization purposes.
- Returns:
RGB version of the image.
- Shape:
image: \((*, 3, H, W)\)
output: \((*, 3, H, W)\)
Example
>>> input = torch.rand(2, 3, 4, 5) >>> rgb = Rgb255ToRgb() >>> output = rgb(input) # 2x3x4x5
- class kornia.color.Rgb255ToNormals(*args, **kwargs)[source]#
Convert an image from RGB [0, 255] to surface normals for visualization purposes.
- Returns:
surface normals version of the image.
- Shape:
image: \((*, 3, H, W)\)
output: \((*, 3, H, W)\)
Example
>>> input = torch.rand(2, 3, 4, 5) >>> normals = Rgb255ToNormals() >>> output = normals(input) # 2x3x4x5
- class kornia.color.NormalsToRgb255(*args, **kwargs)[source]#
Convert surface normals to RGB [0, 255] for visualization purposes.
- Returns:
RGB version of the image.
- Shape:
image: \((*, 3, H, W)\)
output: \((*, 3, H, W)\)
Example
>>> input = torch.rand(2, 3, 4, 5) >>> rgb = NormalsToRgb255() >>> output = rgb(input) # 2x3x4x5