Skip to content

ImperialCollegeLondon/bubble_analyser

Repository files navigation

Bubble Analyser

Python License: GPL v3 Poetry

Overview

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).

Features

  • 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

Installation

Using the Executable (Windows and MacOS)

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

From Source

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.

Usage

  1. Select Input Images: Load images containing bubbles for analysis
  2. Calibrate: Set up pixel-to-mm conversion using a reference image
  3. Process Images: Apply detection algorithms to identify bubbles
  4. Adjust Results: Fine-tune the detected bubbles if needed
  5. Export Data: Save measurements and visualizations

Methods

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:

  1. Download and install Poetry following the instructions for your OS.

  2. Clone this repository and make it your working directory

  3. Set up the virtual environment:

    poetry install
  4. Activate the virtual environment:

    poetry shell

    alternatively, ensure any Python-related command is preceded by `poetry run'.

  5. Install the git hooks:

    pre-commit install
  6. 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.

Dependencies

  • Python 3.12
  • PySide6 (Qt for Python)
  • Tensorflow
  • NumPy
  • SciPy
  • scikit-image
  • OpenCV
  • Matplotlib
  • H5py (for CNN weights)

Reference

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

Contributing

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

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Authors

  • 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

About

A Python application for detecting, measuring, and analyzing bubbles in images.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors