def convert_distance_to_weight(dist_matrix):
    """
    Translate raw distance-to-edge data into weight using parabolic equation.
    Used to give higher priority to pixels located closer to an edge.
    :param dist_matrix: matrix of distances to edges from the distance transform
    :return: adjusted dist_matrix
    """
    height, width = dist_matrix.shape[:2]
    max_dist = width // 30
    a = -1.0 / (max_dist ** 2)
    dist_matrix = a * (dist_matrix ** 2) + 1.0
    neg_indices = dist_matrix < 0.0
    # noinspection PyUnresolvedReferences
    dist_matrix[neg_indices] = 0.0
    return dist_matrix