image thumbnail


version 1.5 (2.58 MB) by Syed Abdullah Aljunid
Matlab App for fitting gaussian beams using a Thorlabs DCx camera / webcam or just upload a file


Updated 04 Mar 2021

From GitHub

View license on GitHub

Position and waists are returned in millimeters and angle in degrees
Resize Factor shrinks the image by the factor (4) to improve fitting time.
Pixel Conv performs a convolution of the nearest neighbours to smoothen out the image
Rotation angle rotates the image to match the beam axis. Use this if the beam axis doesn't match camera(image) axis. Check box Fixed Rotation will make this a free parameter for fitting.

xmin (ymin) is the minimum image pixel to fit the image and witdh (height) of the box to fit in pixels. This is useful if the beam is in a very small part of the image. This is represented by the green box
Pixel size is the multiplication factor for calculating the x/y position and x/y waist.

Output of the fit are X and Y positions (with respect to green box), gaussian beam waist in x and y all in mm. The resize factor is reversed to give the actual value of position and waists based on pixel size.

Needs Optimazation toolbox for fitting, Image Processing toolbox for resize and rotation of image and image acquisition toolbox with support for USB Webcam for getting images from USB webcam. Thorlabs DCx needs DotNet dlls from Thorlabs. Thorlabs Scientific cameras not supported yet

Use predefined test images to test fitting functions. Only Gaussian fits currently implemented.

Cite As

Syed Abdullah Aljunid (2021). MatlabBeamFitting (, GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2019a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.