Droplet Video Processor - code 3 of 3

This code takes the signal generated by parts 1 & 2 and converts it to usable information.
Updated 31 Oct 2013

View License


This is the final part, of a 3 part code used to process video of a T-Junction. You will get an error, if the data from part 2 is not dragged into the command window. This takes the signal made by the previous code and turns it into information. The signal should be a saw tooth, where each spike or trough represents a droplet breaking off. Sample data is included. Aside from the oscillations, this signal should be straight. If it is not, the user can start by cleaning it up; they can:

- Chop up the signal, by picking the first and last data point.
- Smooth the signal, by picking the number of points to average.
- Straighten the Signal, by eliminating any wild jerks (caused by flash of light or dimming in video).
- Remove any outlying data points.

This clean-up is done to both signals. From here, an algorithm goes through both signals and find each moment that a droplet breaks off These times (in seconds) are stored in the seconds array. These times are smoothed out and finally compared and merged together. The code gives you the diameters and frequencies, but also the following:

1. Controls: The controls used to clean up the signal
2. Flow: The flow rate of the fluid breaking into droplets (mL/Hr)
3. Data: A collection of information about the run
4. fSturct: The controls used process the video
5. frameRate: The rate of frames in the video, important to get correct
6. Seconds: This lists the times that droplets were made, allowing you to check code against video

You must upload the data struct each time you run the program or you will get the ObjtSize undefined error. The code runs fast. You will be asked to provide the following input:

Shorten Signal or not? [0/1)
Smooth Signal or not? [0/1)
Straighten Signal or Not? [0/1)
Remove Outlyers or Not? [0/1)

And you will be given the following output:

Diameter:1933.7597 +/-22.9872 (microns)
Frequency:3.9543 +/-0.04 (seconds)
Number of Droplets: 132 (droplets)
Water flow: 5 Oil flow: 100 (mL/Hr)
Length of Video Processed: 8:48.9661 Seconds

Cite As

Matthew Moynihan (2024). Droplet Video Processor - code 3 of 3 (https://www.mathworks.com/matlabcentral/fileexchange/44147-droplet-video-processor-code-3-of-3), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2010b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes