Calculates the normalisation coefficients of potential match positions
       Then normalises the correlation at these positions, and returns them
       if they do indeed constitute a match

def normalise_correlation(image_tile_dict, transformed_array, template, normed_tolerance=1):
    """Calculates the normalisation coefficients of potential match positions
       Then normalises the correlation at these positions, and returns them
       if they do indeed constitute a match
    """
    template_norm = np.linalg.norm(template)
    image_norms = {(x,y):np.linalg.norm(image_tile_dict[(x,y)])*template_norm for (x,y) in image_tile_dict.keys()}
    match_points = image_tile_dict.keys()
    # for correlation, then need to transofrm back to get correct value for division
    h, w = template.shape
    #points_from_transformed_array = [(match[0] + h - 1, match[1] + w - 1) for match in match_points]
    image_matches_normalised = {match_points[i]:transformed_array[match_points[i][0], match_points[i][1]]/image_norms[match_points[i]] for i in range(len(match_points))}
    result = {key:value for key, value in image_matches_normalised.items() if np.round(value, decimals=3) >= normed_tolerance}
    return result.keys()