def calculate_distance(coords, img):
    """
    Function to calculate the relative distance in coords based on the original
    image (img) size.

    Parameters
    ----------
    coords: numpy.ndarray
        Set of 2D coordinates.
    img: numpy.ndarray
        2D array representing the material image to map.

    Returns
    -------
    distance: numpy.ndarray
        Relative distance, as floats, of every absolute distance in coord.

    """
    return coords.astype(float) / img.shape
