Detecting Bubbles Using Image Segmentation

21 views (last 30 days)
I'd like to segment an image similar to the following in order to count the number of "bubbles".
So far, I've tried removing the background mesh using enthropyfilt, and then I used the Canny edge detecting method to find the edges. After this I used imdilate with line structures to get:
This looks reasonably close to what I want, but there are still a lot of regions that don't close, so imfill doesn't give me exactly what I want:
Does anyone have any experience doing similar image processing?

Answers (2)

Ahmet Cecen
Ahmet Cecen on 2 May 2015
Edited: Ahmet Cecen on 2 May 2015
Here is what worked for me for the above image:
1) Crop the scale bar.
2) Remove the shadow gradient.
3) Simple thresholding based on histogram.
4) Remove any connected components smaller than 100 Pixels.
5) Imfill the holes, including the regions that are bounded by the image borders. (Create a routine that adds a line of 1s outside the borders, 1 border at a time, then fill.)
6) Close the image with a 1 radius disk.
This I did in 2 minutes, no more time to improve on this, but I think you can take it from there, below is what it looks like at step 6. You can alter the parameters at different steps if you want each bubble to look as seperate as possible etc.
  1 Comment
GERARDO TAPIA
GERARDO TAPIA on 10 Mar 2020
excellent job, could you help me with the code to understand better the image processing. I will really apreciate it

Sign in to comment.


Image Analyst
Image Analyst on 1 May 2015
Try marker controlled watershed segmentation. See Steve's demo: http://www.mathworks.com/help/images/examples/marker-controlled-watershed-segmentation.html

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!