I am trying to analyze images of elliptical laser beams that are striking 'ground glass' surfaces. I need to determine the size, position and orientation of the ellipse that represents the boundary of the beam. The images are grainy due to random scattering from the irregular surface of the ground glass and in some cases, only a partial ellipse is visible (see the example image below). I would also like to use a mostly circular reference feature (see CAD drawing here) in the image which I know has a diameter of 25.4 mm to convert the spatial coordinates from pixels to mm.
Adjust Image Brightness and Contrast
I use ImageAdjust
to make the circular reference feature and the elliptical beam shape stand out more clearly in the image. FindImageShapes
(available in v13.3) appears to successfully locate the two features.
img = Import["https://i.stack.imgur.com/UGqaR.png"];
imgBRIGHT = ImageAdjust[img, {1, 15}]
e = FindImageShapes[GradientFilter[imgBRIGHT, 3], "Ellipse"]
HighlightImage[imgBRIGHT, Graphics@MaximalBy[e, RegionMeasure, 2]]
The output for e
is a GeometricTransformation
that I do not understand. I took a look at ComponentMeasurements
but I couldn't figure out how to apply this to e
.
Is there a simple way to extract the centers, major and minor axes, and orientation of the found ellipses?