Counting and labelling bubbles coming out of a tube

조회 수: 2 (최근 30일)
William Murray
William Murray 2019년 5월 26일
Hello everyone,
I have a lot of photographs of bubbles coming out of a small tube. I want MATLAB to count the number of bubbles, label each bubble with an index number, and place properies about the bubble (ex. area) next to the index label.
So far I have cropped the image, made it binary, fill in the "holes" in the bubbles, labelled each bubble object with different shades of gray, found the area of each object, and counted the total shades of gray used. However the diffraction of light through the bubbles is causing some issues, see below:
matlab1.png
matlab2.png
There are 10 bubbles in the picture, however the final output counts 7 objects: the 6 floating objects and then the tube on the bottom which is merged with the first 4 bubbles. Due to the light diffraction the bubbles don't appear closed in the binary image, so this messes up the imfill command. The imfill command connects the first 4 bubbles closest to the tubes and creates one large object. The imfill command also increases the size of the bubbles by varying amounts, and this makes the area calculations less accurate.
Could anyone recommend how I could mitigate this problem? Perhaps "closing" the bubbles in the binary image before using the imfill command would work? I am also having trouble apply the labels/indexes onto the cropped image that I can then output.
I am attaching the original image and source code. Any assistance would be appreciated!

답변 (0개)

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by