Skip to content
Snippets Groups Projects
Commit c72ccd7d authored by Tamino Huxohl's avatar Tamino Huxohl
Browse files
parents 9a716fe7 6d14f212
No related branches found
No related tags found
No related merge requests found
......@@ -26,3 +26,14 @@ def to_grayscale(
_img = (img - min_val) / (max_val - min_val)
_img = (_img * 255).astype(np.uint8)
return _img
def grayscale_to_rgb(img: np.ndarray):
"""
Convert a grayscale image to an rgb image by repeating it three times.
:param img: the grayscale image to be converted to rgb
:return: the image in rgb
"""
assert img.ndim == 2, f"grascale image has more than 2 dimensions {img.shape}"
return img.repeat(3).reshape((3, *img.shape))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment