Tracking movement of bubbles in water to obtain velocity

Hello,
I'm working on a project that involves tracking bubbles moving through a water tunnel and using the information to determine their velocities. I'm very new to Matlab and I'm looking for a little guidance on where to start.
I have the basic toolboxes that come with the Student Suite, and Computer Vision; just going through the examples, I found numerous ways to track the bubbles, but I don't know how to convert the tracking to velocity. Any help you can offer is greatly appreciated!
Thanks in advance,
Rob

 Accepted Answer

Robert: To get "real world" units you need to calibrate so that you know how many pixels correspond to 1 cm (or whatever). See my attached spatial calibration demo.
In your reply to Sean you say you need "information about the centroids' location" - what does that mean? You have the x and y location of the centroid - what other info do you need about the centroid location other than the coordinates?

3 Comments

Thanks for the demo, I'll give it a look asap! By the information I meant precisely the x and y coordinates; let me rephrase, I've gotten to the point where (going by the examples) I can overlay the centroids in a plot and confirm that their locations are correct , but I don't know how to use this to get their x-y position.
That doesn't make sense. You said "I managed to find the centroids" - that means you have the x and y locations. In fact you said you plotted them over the image doing something like
measurements = regionprops(labeledImage, 'Centroid');
centroids = [measurements.Centroid];
xCentroids = centroids(:, 1);
yCentroids = centroids(:, 2);
plot(xCentroids, yCentroids, 'r+', 'MarkerSize', 2, 'LineWidth', 3);
So again, you already have the x-y position and there is nothing else left to get. You can attach your image and m-file if you want.
I'm sorry, you're right, I did have the positions already; I thought I had to use another function to get their position, my (embarrassing) mistake. Thank you for your help and your patience!
Rob

Sign in to comment.

More Answers (1)

Easiest way would be to find their centroids ( regionprops or vision.BlobAnalysis), calculate the distance between them ( hypot) and divide that by the time step.
This will give you pixels/second, if you know the pixel size, multiply by this.

1 Comment

Robert's "Answer" moved here since it's a reply to Sean:
Sean,
Thanks, I followed your recommendation and I managed to find the centroids but now I'm just having difficulty getting the information about the centroids' location; I thought I would want to use "getpixelposition" but that doesn't seem to be working (probably for an obvious reason I don't know yet lol).
Do you know of a better function that I should use? And thank you for getting me started with the centroids!

Sign in to comment.

Asked:

on 3 Nov 2014

Commented:

on 4 Nov 2014

Community Treasure Hunt

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

Start Hunting!