perimeter_mask

laserbeamsize.background.perimeter_mask(image: ndarray, corner_fraction: float = 0.035) ndarray[tuple[Any, ...], dtype[bool]][source]

Create boolean mask for image with a perimeter marked as True.

The perimeter is the same width as the corners created by corner_mask which is a fixed percentage (default 3.5%) of the entire image.

If the image is already masked, the perimeter is taken from the bounding box of the unmasked region (where image.mask=False).

Parameters:
  • image – the image to work with (may be a masked array)

  • corner_fraction – determines the width of the perimeter

Returns:

masked_image – 2D array with True values around rect perimeter