(polygon, shrink_ratio)
return polygon
对框进行缩放，返回去的比例为1/shrink_ratio 即可
对框进行缩放，返回去的比例为1/shrink_ratio 即可
对框进行缩放，返回去的比例为1 / shrink_ratio 即可
def shrink_polygon_py(polygon, shrink_ratio):
    """
    对框进行缩放，返回去的比例为1/shrink_ratio 即可
    """
    cx = polygon[:, 0].mean()
    cy = polygon[:, 1].mean()
    polygon[:, 0] = cx + (polygon[:, 0] - cx) * shrink_ratio
    polygon[:, 1] = cy + (polygon[:, 1] - cy) * shrink_ratio
    return polygon
def shrink_polygon_py ( polygon , shrink_ratio ) : cx = polygon [ : , 0 ] . mean ( ) cy = polygon [ : , 1 ] . mean ( ) polygon [ : , 0 ] = cx + ( polygon [ : , 0 ] - cx ) * shrink_ratio polygon [ : , 1 ] = cy + ( polygon [ : , 1 ] - cy ) * shrink_ratio return polygon