Skip to content

Commit 94d382a

Browse files
committed
Aligned greyscale convertion with report
1 parent 680c6e3 commit 94d382a

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

framework/data_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ def convert_to_grayscale(image: np.ndarray) -> np.ndarray:
3030
return image.squeeze(axis=2)
3131
elif image.shape[2] == 3:
3232
# RGB -> Grayscale using luminance weights
33-
# Source: https://www.songho.ca/dsp/luminance/luminance.html
34-
return np.dot(image[...,:3], [0.299, 0.587, 0.114])
33+
# Y = 0.2125R + 0.7154G + 0.0721B
34+
return np.dot(image[...,:3], [0.2125, 0.7154, 0.0721])
3535
elif image.shape[2] == 4:
3636
# RGBA -> Grayscale (ignore alpha)
37-
return np.dot(image[...,:3], [0.299, 0.587, 0.114])
37+
return np.dot(image[...,:3], [0.2125, 0.7154, 0.0721])
3838

3939
raise ValueError(f"Unsupported image shape: {image.shape}")
4040

0 commit comments

Comments
 (0)