BGR#
Tip
Learn more: https://en.wikipedia.org/wiki/RGB_color_model
Functions#
- kornia.color.bgr_to_rgb(image)[source]#
Convert a BGR image to RGB.
- Parameters:
image (
Tensor) – BGR Image to be converted to BGR 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 = bgr_to_rgb(input) # 2x3x4x5
- kornia.color.bgr_to_rgba(image, alpha_val)[source]#
Convert an image from BGR to RGBA.
- Parameters:
- Return type:
- Returns:
RGBA version of the image with shape \((*,4,H,W)\).
Note
The current functionality is NOT supported by Torchscript.
Example
>>> input = torch.rand(2, 3, 4, 5) >>> output = bgr_to_rgba(input, 1.) # 2x4x4x5
Modules#
- class kornia.color.BgrToRgb(*args, **kwargs)[source]#
Convert image from BGR to RGB.
The image data is assumed to be in the range of (0, 1).
- Returns:
RGB version of the image.
- Shape:
image: \((*, 3, H, W)\)
output: \((*, 3, H, W)\)
Example
>>> input = torch.rand(2, 3, 4, 5) >>> rgb = BgrToRgb() >>> output = rgb(input) # 2x3x4x5
- class kornia.color.BgrToRgba(alpha_val)[source]#
Convert an image from BGR to RGBA.
Add an alpha channel to existing RGB image.
- Parameters:
alpha_val (
Union[float,Tensor]) – A float number for the alpha value or a torch.Tensor of shape \((*,1,H,W)\).- Returns:
RGBA version of the image with shape \((*,4,H,W)\).
- Shape:
image: \((*, 3, H, W)\)
output: \((*, 4, H, W)\)
Note
The current functionality is NOT supported by Torchscript.
Example
>>> input = torch.rand(2, 3, 4, 5) >>> rgba = BgrToRgba(1.) >>> output = rgba(input) # 2x4x4x5