def rgb2gray(rgb,biases = [1/3,1/3,1/3]):
    """
    Calculate gray image value from RGB value. May include bias values to correct for luminance differences in layers.

    Parameters
    ----------
    rgb : TYPE
        DESCRIPTION.
    biases : TYPE, optional
        DESCRIPTION. The default is [1/3,1/3,1/3].

    Returns
    -------
    gray : numpy.ndarray
        Gray image (2D).

    """
    r, g, b = rgb[:,:,0], rgb[:,:,1], rgb[:,:,2]
    #biases = [0.2989, 0.5870, 0.1140]
    gray =  biases[0] * r + biases[1] * g + biases[2] * b
    return gray