slmsuite.holography.analysis.image_remove_field#
- image_remove_field(images, deviations=1, out=None)[source]#
Zeros the field of a stack of images such that moment calculations will succeed. Consider, for example, a small spot on a field with strong background. Moment calculations in this situation will dominantly measure the moments of the background (i.e. the field). This function zeros the image below some threshold. This threshold is set to either the mean plus
deviationsstandard deviations, computed uniquely for each image, or the median of each image ifdeviationsisNone. This is equivalent to background subtraction.Important
If a stack of images is provided, field removal is done individually on each image. Field removal is not done in aggregate.
- Parameters:
images (numpy.ndarray) – A matrix in the style of the output of
take(), with shape(image_count, h, w), where(h, w)is the width and height of the 2D images andimage_countis the number of images. A single image is interpreted correctly as(1, h, w)even if(h, w)is passed, though the returned image remains shape(h, w)in that case.deviations (int OR None) – Number of standard deviations above the mean to set the threshold. If
None, uses the median as the threshold instead. Defaults toNone.out (numpy.ndarray or None) – The array to place the output data into. Should be the same shape as
images. This function operates in-place ifoutequalsimages.
- Returns:
out –
imagesor a copy ofimages, with each image background-subtracted.- Return type:
numpy.ndarray