util.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:sldc 作者: waliens 项目源码 文件源码
def draw_poly(image, polygon, color=255):
    """Draw a polygon in the given color at the given location"""
    pil_image = fromarray(image)
    validated_color = color
    draw = ImageDraw(pil_image)
    if len(image.shape) > 2 and image.shape[2] > 1:
        validated_color = tuple(color)
    draw.polygon(polygon.boundary.coords, fill=validated_color, outline=validated_color)
    return np.asarray(pil_image)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号