I am looking to find an algorithm/method by which I can detect regions of flow in a video. The video is that of a grayscale heatmap where the majority of the image is not in motion. The areas that are in motion generally appear as flickering/moving white dots, whereas in the rest of the image the dots do not move. The easiest way to visualize this is to think of a TV screen with noise, but the noise is only changing in certain areas; I would like to detect these areas.

The current method being implemented to do so is simply to calculate the standard deviation of each pixel over time and use this as a rough estimate of movement. While this does produce the desired image, and it is rather fast, I'm not a huge fan of the method because it doesn't care about how fast things are changing (std(sin(x) == std(sin(2x))).

Based off of this paper by the University of Texas, I tried to estimate regions of flow by the Black and Anandan algorith. Specifically, I used this piece of Matlab code produced by Brown University. Unfortunately, not only does it take forever to run, but it really does not seem to be working (shows areas of high flow where there most certainly is not any). I don't have much of a background in image/signal processing so it is entirely possible that I'm messing up the implementation, but I don't think this is the case.

My question is this: can anyone think of any alternatives I could use that help to estimate regions of flow? Also, am I wrong in thinking that the current method (taking the standard deviation wrt. time) is flawed?

Thanks in advance for any help.

  • 1
    $\begingroup$ There are a couple ideas that you could try depending on how the images look. If you are able to track the points through time (eg, beads on top of a fluid), then you could try some sort of particle-tracking method or digital image correlation. Neither of these methods would work well if your points are flickering in and out, so you could run into trouble if this is the case. Maybe some moving time-average would smooth things out enough to use one of the above methods. It's hard to give better advice than that unless you post a few frames so we can get an idea of what we're looking at. $\endgroup$ Sep 17, 2015 at 21:42
  • $\begingroup$ @TylerOlsen, Unfortunately just a posting a few frames really isn't enough to see the effect; you would need the full video, which I don't think I can post because of policies in place (probably can't post the picture anyways). My current attempt is to look at the fast fourier transform of each pixel over time and try to isolate which frequencies correspond to the movement of particles. $\endgroup$
    – wes3449
    Sep 18, 2015 at 19:34
  • $\begingroup$ I also would not be offended if this question was considered too broad and as such closed, if that is what people believe. (I somewhat believe so myself...) $\endgroup$
    – wes3449
    Sep 18, 2015 at 19:35
  • $\begingroup$ Have you looked at current Particle Image Velocimetry software? There are good tools to turn video to a sequence of images. Sometimes they are not evenly spaced in time, but that depends on the compression. (ltcf.mechse.illinois.edu/downloads/Software/PIVSleuth/…) (ltcf.mechse.illinois.edu/downloads/Software/PIVSleuth/XP.html) $\endgroup$ Sep 18, 2015 at 22:38

1 Answer 1


This is not my field any more, but when I was a student, I remember people advocating the use of Markov Chain for this kind of things. Maybe something to search for, although I expect that things have moved on since. Indeed the paper you mention seems to be an evolution of it.

I don't really understand why the "Texas method" is not working, not having read the whole paper nor seen your data. Maybe the segmentation part of their algorithm is counter productive in your case, if the morphology of your flow is not compatible with their algorithm?

Also, you talk about "flickering/moving dots". These are not the same things. Flickering will show as a motion only if the phase of different points are correlated (is it why you use "sin(x)"?). In the case of moving dots, they'll show a motion if there's coherence in their amplitude; then particle tracking software could indeed be a solution, as pointed by EngrStudent, depending how big your dots are, which again goes back to a problem of segmentation (check if one of these are working: http://www.mashanov.uk/, you may need ImageJ http://imagej.nih.gov/ij/download.html )

One thing should still be true in any case: you're saying that the "dots" are only changing in the area of interest. It seems to me that you could increase the speed/ease of detection by doing a Background Subtraction before tracking your flow.

Hope that helps a bit, and thank you for having made me think again about my student years...

  • $\begingroup$ I believe you may have hit the problem on its head (or whatever the saying is). Essentially the problem is that the particles I'm interested in tracking are flowing in and out of focus, causing a flickering. This likely explains why the Texas method is not working; the particles can't be tracked. At this point, I think I'll post an answer saying what my current solution is, but I feel as though your answer should be marked as best because it outlines why the above methods were not working. $\endgroup$
    – wes3449
    Sep 24, 2015 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.