Beam Detection¶
Functions that relate to beam detection such as checking for beam presence and finding beam centroids.
-
psbeam.beamdetector.
detect
(image, resize=1.0, kernel=(9, 9), thresh_mode='otsu', uint_mode='scale', thresh_factor=1, filters=None, **kwargs)¶ Checks for beam presence and returns the centroid and bounding box of the beam. Raises a
NoBeamDetected
exception if no beam is found.Parameters: - image (np.ndarray) – Image to detect the beam on
- resize (float, optional) – Resize factor (1.0 keeps image same size).
- kernel (tuple, optional) – Tuple of length 2 for gaussian kernel size.
- thresh_mode (str, optional) –
Thresholding mode to use. For extended documentation see preprocessing.threshold_image. Valid modes are:
[‘mean’, ‘top’, ‘bottom’, ‘adaptive’, ‘otsu’] - uint_mode (str, optional) –
- Conversion mode to use when converting to uint8. Valid modes are:
- [‘clip’, ‘norm’, ‘scale’]
- factor (int or float, optional) – Factor to pass to the binary threshold.
- filters (callable or iterable, optional) – Beam filters that are run before attempting to find the centroids and bounding box. If the function returns False, NoBeamDetected is raised
Returns: Tuple of centroid and bounding box
Return type: tuple
Raises: NoBeamDetected
– If there was no beam found on the image or if a filter returns FalseInputError
– If an invalid filter type is passed