add_polygon_to_mask#

diffsims.utils.mask_utils.add_polygon_to_mask(mask, coords, fill=False)[source]#

Add a polygon defined by sequential vertex coordinates to the mask.

Parameters:
  • mask ((H, W) array of dtype bool) – boolean mask for an image

  • coords ((N, 2) array) – (x, y) coordinates of vertices

  • fill (int, optional) – Fill value. 0 is black (negative, False) and 1 is white (True)

Returns:

the mask is adjusted inplace

Return type:

None