Bubble Analyser is a Python application for detecting, measuring, and analyzing bubbles in images。 It provides advanced image processing capabilities using watershed segmentation algorithms to accurately identify and measure bubbles of various sizes and distributions. Additionally, it offers manual adjustment tools for fine-tuning segmentation results when needed. This project is improved based on the first version of Bubble Analyser (Mesa et al., 2022).
- Image Processing: Preprocess images with various transformations
- Bubble Detection: Identify bubbles using advanced watershed segmentation algorithms or BubMask (Kim & Park, 2021) (Deep Learning)
- Interactive Ellipse Adjuster: Brand new manual adjustment interface for pixel-perfect refinement of detected bubbles
- Measurement: Calculate size, shape, and distribution of bubbles
- Calibration: Convert pixel measurements to real-world units (mm)
- Results Visualization: Generate histograms and statistics of bubble distributions
- User-Friendly GUI: Intuitive interface for different functionalities
For users on either Windows or MacOS platform, a standalone executable is available for each one in the release:
v0.3.0 https://github.com/ImperialCollegeLondon/bubble_analyser/releases/tag/v0.3.0
v0.2.0 https://github.com/ImperialCollegeLondon/bubble_analyser/releases/tag/v0.2.0
To install from source, follow the developer setup instructions below.
Important
Using CNN Detection: For user running from source code, you must download mask_rcnn_bubble.h5 from the v0.3.0 release page and place it in the bubble_analyser/weights directory.
- Select Input Images: Load images containing bubbles for analysis
- Calibrate: Set up pixel-to-mm conversion using a reference image
- Process Images: Apply detection algorithms to identify bubbles
- Adjust Results: Fine-tune the detected bubbles if needed
- Export Data: Save measurements and visualizations
Bubble Analyser implements multiple segmentation approaches:
- Normal Watershed: Standard watershed algorithm with triple threshold, based on the first version of Bubble Analyser (Mesa et al., 2022).
- Iterative Watershed: Advanced algorithm that iteratively applies thresholds to detect objects at different intensity levels.
- BubMask (Deep Learning): Integrated BubMask (Kim & Park, 2021), a Mask R-CNN based deep learning model for superior accuracy in complex lighting or overlapping conditions.
To get started:
-
Download and install Poetry following the instructions for your OS.
-
Clone this repository and make it your working directory
-
Set up the virtual environment:
poetry install
-
Activate the virtual environment:
poetry shell
alternatively, ensure any Python-related command is preceded by `poetry run'.
-
Install the git hooks:
pre-commit install
-
Run the main app:
python -m bubble_analyser
or, you can build up the virtual environment based on the requirements.txt file in the root directory.
- Python 3.12
- PySide6 (Qt for Python)
- Tensorflow
- NumPy
- SciPy
- scikit-image
- OpenCV
- Matplotlib
- H5py (for CNN weights)
Kim, Y., Park, H. Deep learning-based automated and universal bubble detection and mask extraction in complex two-phase flows. Sci Rep 11, 8940 (2021). https://doi.org/10.1038/s41598-021-88334-0
Contributions are welcome! Please feel free to submit a Pull Request. If you would like to add more image processing algorithms, please see the guidance under the directory Methods
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
- Mr Yiyang Guan - Department of Earth Science and Engineering, Imperial College London
- Dr Diego Mesa - Department of Earth Science and Engineering, Imperial College London
- Dr Diego Alonso Álvarez - Imperial College London RSE Team, Imperial College London
- Dr Paulina Quintanilla - Department of Chemical Engineering, Brunel University
- Dr Francisco Reyes - IntelliSense.io, Queensland, Australia