![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/176533/image.png)
Detecting Bubbles Using Image Segmentation
17 次查看(过去 30 天)
显示 更早的评论
I'd like to segment an image similar to the following in order to count the number of "bubbles".
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/149685/image.jpeg)
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/149688/image.jpeg)
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/149690/image.jpeg)
Does anyone have any experience doing similar image processing?
0 个评论
回答(2 个)
Ahmet Cecen
2015-5-2
编辑:Ahmet Cecen
2015-5-2
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/176533/image.png)
1 个评论
GERARDO TAPIA
2020-3-10
excellent job, could you help me with the code to understand better the image processing. I will really apreciate it
Image Analyst
2015-5-1
Try marker controlled watershed segmentation. See Steve's demo: http://www.mathworks.com/help/images/examples/marker-controlled-watershed-segmentation.html
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!