Bubble analysis : how to separate following bubbles ?

12 views (last 30 days)
I need to study bubbles in my device, here is an example of two bubbles (they are evolving in a Hele-shaw cell).
Bubble_example.PNG
In order to characterize them, I want to know their equivalent diameter, center, area ... For that, I was just taking the inner pixels (inside the black pixels) and was analyzing them with regionprops. Now, the bubble can also be represented with the outer radius, and I want to do a average radius, and area. So I need to characterize the inner bubble (without black borders) and outer bubble (bubble with black borders). The problem is that the border between the two bubbles is not well defined.
. In order to have that, my solution was :
  • First, image thresholding, using imbinarize
bubble_2.PNG
  • There, I can easily get information about inner diameter, center (regionprops)
  • Then, imcomplement the previous image
bubble_3.PNG
  • With this segmentation, if there is an unique bubble, it is easy to have information about the outer equivalent diameter and center, but here, I don't really know how to proceed. I tried to do a imfill with holes, but the regionprops will only find one bubble because it will appear as only one bubble.
To solve this problem, I tried the imfindcircles, who gives ok results with the previous image and finds approximatively the two circles. But now, I also have those kind of bubbles, and in this case, neither regionprops or imfindcircles works when I want to find the outer radius for each bubble.
dessin.png
Thanks for helping :)

Answers (1)

Akira Agata
Akira Agata on 10 Dec 2018
By combining some functions, characteristics (equivalent diameter, center, area...etc) of each bubble can be calculated. The following is one example.
% Import your bubble image (attached file)
I = imread('bubble.png');
Igray = rgb2gray(I);
% Binarize and remove non-target regions in the image
BW = imbinarize(Igray,'adaptive',...
'ForegroundPolarity','dark','Sensitivity',0.5);
se = strel('disk',5);
BW = imopen(BW,se);
BW = imclearborder(BW);
BW = bwareafilt(BW,[200 Inf]);
% Apply regionprops
s = regionprops('table',BW,{'Area','Centroid','EquivDiameter'});
% Visualize the result
L = bwlabel(BW);
Lrgb = label2rgb(L);
figure
subplot(1,2,1)
imshow(I)
hold on
scatter(s.Centroid(:,1),s.Centroid(:,2),'rx')
subplot(1,2,2)
imshow(Lrgb)
bubbleAnalysis.png
  1 Comment
Christopher Madec
Christopher Madec on 11 Dec 2018
Hi,
Thanks for your answer. I forgot to use morphological transformations, and now some of my results are better ! :)
However, I think I was not very clear on what I meant by determining bubble properties. As I said, what I want is to determine the inner AND outer radius of bubbles, as shown below :
téléchargement (1).png
Your code permits to analyze and give red circles, but I also want to highlight violet areas with my code, and I don't know how to properly do it. The problem is at boundaries between bubbles, which are deleted when using some of the morphological operations (maybe I'm not using them in a good way .. ?).
Thanks for helping me !

Sign in to comment.

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!