corner_mask

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

Create boolean mask for image with corners marked as True.

Each of the four corners is a fixed percentage of the entire image. ISO 11146-3 recommends values from 2-5% for corner_fraction the default is 0.035=3.5% of the image.

If the image is already masked, the corners are 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 – the fractional size of corner rectangles

Returns:

masked_image – 2D array with True values in four corners