def rgb2gray(rgb_img):
    """
    Parameters
    ----------
    rgb_img : numpy array with shape as (3, X, Y)
        image to convert in gray

    Returns
    -------
    gray_img , the grayscale image
    """
    gray_coef = [0.2989, 0.5870, 0.1140]

    r = rgb_img[0] / 255
    g = rgb_img[1] / 255
    b = rgb_img[2] / 255

    gray_img = gray_coef[0] * r + gray_coef[1] * g + gray_coef[2] * b

    return gray_img * 255