Detection of the bubbles
The initial images are noisy and have non uniform intensity (depends on the lighting). The first step is to reduce noise and to remove the background of the image.
Then, we enhance the contraste and we segment the image: A toggle mapping is used to enhance the image and the segmenation is a simple automatic threshold. (Fisher method).
From left to right : toggle mapping, automatic segmentation and area opening (suppression of the small particles).
Binary image processing: various stages of mathematical morphology are applied, dilation close hole, the ultimate erosion and many more...