π Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
Fix typo in color files
HassanAlsamahi948c5103d22a
diff --git a/kornia/color/gray.py b/kornia/color/gray.pyindex 5667bca41..482b0c771 100644--- a/kornia/color/gray.py+++ b/kornia/color/gray.py@@ -8,7 +8,7 @@ class RgbToGrayscale(nn.Module):the image data is assumed to be in the range of (0, 1).args:- input (torch.Tensor): image to be converted to grayscale.+ input (torch.Tensor): RGB image to be converted to grayscale.returns:torch.Tensor: grayscale version of the image.@@ -37,7 +37,7 @@ def rgb_to_grayscale(input: torch.Tensor) -> torch.Tensor:See :class:`~kornia.color.RgbToGrayscale` for details.Args:- input (torch.Tensor): Image to be converted to grayscale.+ input (torch.Tensor): RGB image to be converted to grayscale.Returns:torch.Tensor: Grayscale version of the image.@@ -50,6 +50,7 @@ def rgb_to_grayscale(input: torch.Tensor) -> torch.Tensor:raise ValueError("Input size must have a shape of (*, 3, H, W). Got {}".format(input.shape))+# https://docs.opencv.org/4.0.1/de/d25/imgproc_color_conversions.htmlr, g, b = torch.chunk(input, chunks=3, dim=-3)gray: torch.Tensor = 0.299 * r + 0.587 * g + 0.110 * bdiff --git a/kornia/color/hsv.py b/kornia/color/hsv.pyindex 0c8aaa6e9..9b35ad42e 100644--- a/kornia/color/hsv.py+++ b/kornia/color/hsv.py@@ -7,15 +7,21 @@ class HsvToRgb(nn.Module):The image data is assumed to be in the range of (0, 1).args:- image (torch.Tensor): RGB image to be converted to HSV.+ image (torch.Tensor): HSV image to be converted to RGB.returns:- torch.tensor: HSV version of the image.+ torch.tensor: RGB version of the image.shape:- image: :math:`(*, 3, H, W)`- output: :math:`(*, 3, H, W)`+ Examples::++ >>> input = torch.rand(2, 3, 4, 5)+ >>> rgb = kornia.image.HsvToRgb()+ >>> output = rgb(input) # 2x3x4x5+"""def __init__(self) -> None:@@ -30,11 +36,11 @@ def hsv_to_rgb(image):The image data is assumed to be in the range of (0, 1).Args:- input (torch.Tensor): RGB Image to be converted to HSV.+ input (torch.Tensor): HSV Image to be converted to RGB.Returns:- torch.Tensor: HSV version of the image.+ torch.Tensor: RGB version of the image."""if not torch.is_tensor(image):@@ -82,6 +88,12 @@ class RgbToHsv(nn.Module):- image: :math:`(*, 3, H, W)`- output: :math:`(*, 3, H, W)`+ Examples::++ >>> input = torch.rand(2, 3, 4, 5)+ >>> hsv = kornia.image.RgbToHsv()+ >>> output = hsv(input) # 2x3x4x5+"""def __init__(self) -> None:diff --git a/kornia/color/rgb.py b/kornia/color/rgb.pyindex cd9903a0f..2d5402638 100644--- a/kornia/color/rgb.py+++ b/kornia/color/rgb.py@@ -17,6 +17,12 @@ class RgbToBgr(nn.Module):- image: :math:`(*, 3, H, W)`- output: :math:`(*, 3, H, W)`+ Examples::++ >>> input = torch.rand(2, 3, 4, 5)+ >>> bgr = kornia.image.RgbToBgr()+ >>> output = bgr(input) # 2x3x4x5+"""def __init__(self) -> None:@@ -56,6 +62,12 @@ class BgrToRgb(nn.Module):- image: :math:`(*, 3, H, W)`- output: :math:`(*, 3, H, W)`+ Examples::++ >>> input = torch.rand(2, 3, 4, 5)+ >>> rgb = kornia.image.BgrToRgb()+ >>> output = rgb(input) # 2x3x4x5+"""def __init__(self) -> None: