Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

Modify code form

HassanAlsamahif3736da278a9
diff --git a/kornia/color/hls.py b/kornia/color/hls.py
index f4dcf5106..a2d67254c 100644
--- a/kornia/color/hls.py
+++ b/kornia/color/hls.py
@@ -135,7 +135,7 @@ def rgb_to_hls(image):
deltac: torch.Tensor = maxc - minc
- s: torch.Tensor = torch.where(l < 0.5, deltac / (maxc + minc), deltac /(2 - (maxc + minc))) # saturation
+ s: torch.Tensor = torch.where(l < 0.5, deltac / (maxc + minc), deltac / (2 - (maxc + minc))) # saturation
hi: torch.Tensor = torch.zeros_like(deltac)
diff --git a/test/color/test_hls.py b/test/color/test_hls.py
index 443a70848..b87fe71d5 100644
--- a/test/color/test_hls.py
+++ b/test/color/test_hls.py
@@ -108,13 +108,13 @@ class TestHlsToRgb:
[8., 8.]]])
data = torch.tensor([[[0.0641, 0.07138],
- [0.07138, 0.07138]],
+ [0.07138, 0.07138]],
- [[0.0569, 0.0588],
- [0.0588, 0.0588]],
+ [[0.0569, 0.0588],
+ [0.0588, 0.0588]],
- [[0.4483, 0.4667],
- [0.4667, 0.4667]]])
+ [[0.4483, 0.4667],
+ [0.4667, 0.4667]]])
f = kornia.color.HlsToRgb()
assert_allclose(f(data), expected / 255, atol=1e-3, rtol=1e-7)
@@ -131,13 +131,13 @@ class TestHlsToRgb:
[8., 8.]]]) # 3x2x2
data = torch.tensor([[[0.0641, 0.07138],
- [0.07138, 0.07138]],
+ [0.07138, 0.07138]],
- [[0.0569, 0.0588],
- [0.0588, 0.0588]],
+ [[0.0569, 0.0588],
+ [0.0588, 0.0588]],
- [[0.4483, 0.4667],
- [0.4667, 0.4667]]]) # 3x2x2
+ [[0.4483, 0.4667],
+ [0.4667, 0.4667]]]) # 3x2x2
f = kornia.color.HlsToRgb()
data = data.repeat(2, 1, 1, 1) # 2x3x2x2