This function takes an RGB image as input and gives the FWHM and 1/e^2 radius of Gaussian-assumed speckles in the horizontal and vertical directions in pixel units.
The function is heavily commented for very easy use, and all mathematical steps are explained in the comments. Briefly, the autocovariance of each row (column) is averaged; the resulting plot is fitted to a Gaussian, from which the horizontal (vertical) FWHM and 1/e^2 values are calculated.
In addition, the function outputs the goodness-of-fit statistics for this Gaussian fit. These should always be checked to ensure proper functioning.
Hey Joel. I looked into your source and found that you have misunderstood how the correlation length can be obtained from the auto-covariance. You are using the FWHM of the fit. The correlation length is the value of the integral itself.
The units are just in 'pixels'. If you acquire the image with a camera you would have to find the dimensions of one pixel on your own, perhaps by using a reference (e.g. I know this object is 1.0cm long) or perhaps by some more complicated calculation if you use lenses to focus an image onto a digital camera. Manufacturers' datasheets give pixel sizes for most digital cameras, I believe, which would be one part of that calculation. It is true that without having a pixel-to-distance conversion the program doesn't help much.