# Identify and measure single bubble radius in series of images (TIFF)

I aim to make use of Mathematica's image processing capabilities to measure the radius of bubbles in consecutive images taken with a high-speed camera.

After searching through this website I have already found some guidance and came up with some lines of code on my own. This works okeyish for bubbles which are more or less spherical, but towards the end of a bubble cycle, the code does not work properly, as the bubble shape is strongly noncircular.

Does anybody have a smart idea to improve my work and/or to tackle the challenge with the noncircular bubble shape? Many thanks in advance either way.

Here's what I did so far after importing one image and assigning it to img:

imgHisto = HistogramTransform[img]
imgGrad = ImageAdjust@GradientFilter[imgHisto, {2, 0}]
imgMorphBin = MorphologicalBinarize[imgGrad]
imgDil = Dilation[imgMorphBin, DiskMatrix[6]]
imgClose = ColorNegate@Closing[imgDil, DiskMatrix[6]]
imgSmallComp = DeleteSmallComponents[imgClose, 20^2]
imgDeleteBorder = DeleteBorderComponents[imgSmallComp]
d =ComponentMeasurements[
ImageData@imgDeleteBorder, {"Label", "BoundingDiskCenter", "BoundingDiskRadius", "Area"}]
If[d != {},
label = d[[All, 2, 1]];
center = d[[All, 2, 2]];
radius = d[[All, 2, 3]];
area = d[[All, 2, 4]];,
(*else*)
center = 0;
radius = 0;
label = 0;
area = 0;
];
circle = Flatten[Reap[
For[i = 1, i <= Length[radius], i++,
Sow[{center[[i]], radius[[i]]}];
]
][[2]], 1];
Show[img, Graphics[{Red, Circle @@@ circle}]]


The input images are as follows:

The result of my code:

• Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory Tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. – bbgodfrey Jun 24 '15 at 15:07
• Two things to try: first, since you have lots of frames, why not use them all? Look at the difference images to help distinguish where changes are from frame to frame (rather than trying to process each frame independently). Secondly, instead of using the Disk features of ComponentMeasurements, use the ellipse features (called Parameters of the oriented best-fit ellipse in the docs) – bill s Jun 24 '15 at 15:40