How to calculate spray cone angle with videos?

Hello, everyone!
I have a high-speed video where a new spray image appears approximately every second, and I need to automate the extraction of the spray cone angle for each frame. Additionally, I would like to generate a plot to demonstrate the angle variations after every 200 analyses. I would greatly appreciate any suggestions, relevant functions, or example scripts regarding the best image processing workflow for boundary detection, as well as advice on how to structure the loop for sequential processing and periodic plot updates. Thank you very much for your time and patience!

Answers (1)

I've posted spray angle demos before. Have you searched the Answers forum?

2 Comments

Hi Image Analyst! I actually found a sample code you posted here before and adapted it to my conditions. However, I'm having trouble with the results — there are errors in the edge detection and fit interpretations, leading to mostly NaN values. What could be going wrong? Please forgive me if it's a silly mistake, I'm still learning how to analyze these codes!
Where do you want to measure the angle? Because the "edges" of the spray get very broken and arbitrary after about line 75. You could find the first and last pixel in the binary image line by line but that will not get you very linear edge of the spray - it will be very noisy and wiggly. It would be better if you could average together a bunch of frames and find the angle from the average of many frames. Also it looks like the nozzle is fixed in position and the mounting bracket ends around line 20 so you'd want to crop the image (or whiten it) so that the mounting bracket is not considered part of the spray.

Sign in to comment.

Asked:

on 15 May 2026

Commented:

on 10 Jun 2026

Community Treasure Hunt

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

Start Hunting!