laserbeamsize.background Module
Routines for removing background for beam analysis.
Full documentation is available at <https://laserbeamsize.readthedocs.io>
Two functions are used to find the mean and standard deviation of images. corner_background() uses just the corner pixels and iso_background() uses all un-illuminated pixels:
>>> import imageio.v3 as iio
>>> import laserbeamsize as lbs
>>>
>>> file = "https://github.com/scottprahl/laserbeamsize/raw/master/docs/t-hene.pgm"
>>> image = iio.imread(file)
>>>
>>> mean, stdev = lbs.corner_background(image)
>>> print("The corner pixels have an average %.1f ± %.1f)" % (mean, stdev))
>>> mean, stdev = lbs.iso_background(image)
>>> print("The un-illuminated pixels have an average %.1f ± %.1f)" % (mean, stdev))
In addition to these functions, there are a variety of subtraction functions to remove the background. The most useful is subtract_iso_background() which will return an image with the average of the un-illuminated pixels subtracted:
>>> import imageio.v3 as iio
>>> import laserbeamsize as lbs
>>>
>>> file = "https://github.com/scottprahl/laserbeamsize/raw/master/docs/t-hene.pgm"
>>> image = iio.imread(file)
>>>
>>> clean_image = subtract_iso_background(image)
Functions
|
Return the mean and stdev of background in corners of image. |
|
Return the background for unilluminated pixels in an image. |
|
Subtract a background image from the image with beam. |
|
Return image with a constant value subtracted. |
|
Return image with background subtracted. |
|
Return image with ISO 11146 background subtracted. |
|
Return image with tilted planar background subtracted. |