def _sim_fill ( r1 , r2 , imsize ) : bbsize = ( ( max ( r1 [ "max_x" ] , r2 [ "max_x" ] ) - min ( r1 [ "min_x" ] , r2 [ "min_x" ] ) ) * ( max ( r1 [ "max_y" ] , r2 [ "max_y" ] ) - min ( r1 [ "min_y" ] , r2 [ "min_y" ] ) ) ) return 1.0 - ( bbsize - r1 [ "size" ] - r2 [ "size" ] ) / imsize
finding the similarity between 2 images in python
calculate the fill similarity over the image
def _sim_fill(r1, r2, imsize):
    """
        calculate the fill similarity over the image
    """
    bbsize = (
        (max(r1["max_x"], r2["max_x"]) - min(r1["min_x"], r2["min_x"]))
        * (max(r1["max_y"], r2["max_y"]) - min(r1["min_y"], r2["min_y"]))
    )
    return 1.0 - (bbsize - r1["size"] - r2["size"]) / imsize