My colleagues are working on bubbly flows and the would like to detect bubble from a static image like the following one.
They want to know the center coordinate of each bubble in the image and its radius (assuming the bubbles are circles). They have thousands of similar images waiting to be processed and there must be an automated way to perform the task. I am recently working with the OpenCV package which has almost everything needed off the shelf. So I just wrote a short script to do the job.
Procedures
The script reads an image from the file system, shows it in an OpenCV window.
The image is converted into gray-scale and blurred.
The image is further processed such that the “holes” are filled with solid color.
The Hough transformation implemented by OpenCV is then used to detect circle patterns
Re-draw the original image with detected circles colored in green.
OpenCV does a pretty good job if the parameters are set properly.