A program to capture and analyze droplets
Project description
Python sessile drop analysis
Made by Mathijs van Gorcum, based the core written during his PhD at the Physics of Fluids group of the University of Twente.
Python program to analyze sessile drops by measuring contact angle, drop volume and contact line position (as function of time or framenumber).
This program can capture images or movies from a camera or import image sequences (in the form of an movie file, a tiffstack or a single image) and measures the contact angle, drop volume and the contact line position.
The program assumes an image of a drop on the surface, where the drop is dark, and the background is light.
A crop (to increase calculation speed, and cut off any irrelevant parts) and a baseline must be set on the view of the image. The Edgepixels to fit
setting increases the amount of pixels up from the baseline used to measure the contact angle and contact line position.
We use a subpixel edge detection, either fast, with a linear interpolation between two pixels around the edge, or slow by fitting an error function around the edge.
To find the contact line position and the contact angle the detected edge is fitted with a configurable order polynomial fit, and the slope of the baseline is also used to calculate the contact angles.
Note that the drop volume assume cylindrical symmetry and if there is a needle present, the volume of the needle is added for as much as it is in view of the crop.
Screenshot
Prerequisites
If you don't use the precomiled releases nor pip install
it you'll need:
The script requires numpy, pandas, scipy, pyqt5, opencv-python, fast-histogram, imageio, shapely, pyqtgraph >=0.11.0, openpyxl, toml, h5py, json, and appdirs.
Install and running
This program has an installer for windows available in the releases assets on github, or is installable from pypi.org with pip install drop-analysis
.
To install the program from source pip install .
in the sessile.drop.analysis folder.
To run the program after installing simply run drop_analysis
in the terminal.
Support
If you have any questions feel free to join the #Sessile.Drop.Analysis:matrix.vgorcum.com matrix room (as linked above) or open an issue on github.
Some details
- The code is written for Python 3.8
- The edge detection uses only a horizontal subpixel correction, and when fitting the errorfunction, 40 pixels left and right of the edge are used.
- To find the contact angle and contact point a polyfit is used, but the fit is made flipping the x and y coordinates, because polyfits don't perform well for vertical lines (ie at contact angles of 90 degrees).
- The threshold is calculated using otsu's method, for the fast edge detection the value is used explicitly while for the error function fitting the value is only used to find an approximate edge, to fit the errorfunction around.
- The program calculates the speed in pixels/frame, and the volume in pixels^3, so be sure to convert it.
Contributing
Feel free to send pull requests, critique my awful code or point out any issues.
License
This project is licensed under the GPLv3 license - see the LICENSE file for details
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for drop_analysis-0.2.0b0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3da1fe13f6fe8b53e02a8f674518b5ac95d8ccc6814b4e146ca7f0c3a08667a0 |
|
MD5 | 0213c7757ba29ff5ddf4f5e8fd7209bb |
|
BLAKE2b-256 | 7ce37db78d917b0e4c6206b6415a0129cc244c49983a6dc9193596403445d8b4 |