laserbeamsize.analysis Module
A module for finding the beam size in an monochrome image.
Full documentation is available at <https://laserbeamsize.readthedocs.io>
Simple and fast calculation of beam sizes from a single monochrome image based on the ISO 11146 method of variances. Some effort has been made to make the algorithm automatically handle background noise.
Finding the center and diameters of a beam in a monochrome image is simple:
>>> 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)
>>>
>>> x, y, dx, dy, phi = lbs.beam_size(image)
>>> print("The center of the beam ellipse is at (%.0f, %.0f)" % (x, y))
>>> print("The ellipse diameter (closest to horizontal) is %.0f pixels" % dx)
>>> print("The ellipse diameter (closest to vertical) is %.0f pixels" % dy)
>>> print("The ellipse is rotated %.0f° ccw from the horizontal" % (phi * 180/3.1416))
Functions
|
Determine the beam center, diameters, and tilt using ISO 11146 standard. |
|
Determine beam parameters in an image with noise. |