π Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
Fix bgr2gray formula
HassanAlsamahibe2f30603c41
diff --git a/kornia/color/gray.py b/kornia/color/gray.pyindex 317e55ce7..00440e592 100644--- a/kornia/color/gray.py+++ b/kornia/color/gray.py@@ -1,5 +1,6 @@import torchimport torch.nn as nn+from .rgb import bgr_to_rgbclass RgbToGrayscale(nn.Module):@@ -109,6 +110,6 @@ def bgr_to_grayscale(input: torch.Tensor) -> torch.Tensor:raise ValueError("Input size must have a shape of (*, 3, H, W). Got {}".format(input.shape))- b, g, r = torch.chunk(input, chunks=3, dim=-3)- gray: torch.Tensor = 0.299 * r + 0.587 * g + 0.110 * b+ bgr_rgb = bgr_to_rgb(input)+ gray = rgb_to_grayscale(bgr_rgb)return gray