def get_mask_polygons(polygons, height, width):
"""Turn a list of polygons into a mask image of height by width.
Each polygon is expressed as a list of [x, y] points."""
mask = np.zeros((height, width), dtype=np.ubyte)
cv2.fillPoly(mask, np.int32(polygons), color=255)
return mask
评论列表
文章目录