I have as example a set of 30 gray scale images (8bit, 568*478 pixels, they are avalable here: https://drive.google.com/open?id=0B9wKP6yNcpyfMm0ycGZHMjJrRlE) where bright objects on dark background move from image to image mainly horizontally with different velocities (at the upper and lower edge to the left, in the center to right).
This is how the animated gif (5fps) of the images looks like:
My aim is to measure what the mean velocity of the objects is and in which direction they are in average moving.
For that it would be sufficient to subdivide each image in e.g. 10 times 10 rectangles (and determine in each the mean velocity and direction.) I do not want to track the individual single objects coordinates (since this is often not possible when they overlap in an image).
To get a qualitative impression about the overall movement I tried two methods:
a. Superposition of maximum brightness in all images.
We have here a qualitative measure for the velocities but not their direction.
b. Consecutive superposition of images whereby the objects were color coded from blue over green, yellow to red.
In here one can see even in a single image that the objects have different velocities (faster at edges), approximately the positions where they start and end, and in which direction they are streaming (at vertical edges toward left, in the center towards right and in some parts they don't move much).
To solve my problem I thought ImageFeatureTrack
or ImageDisplacements
could be appropriate. Unfortunately I have not much experience with these functions and was not successful to come to a result.
ImageDisplacements
produces something like that (here only 12 images are used, not to exceed 2MB):
This quick result is not as good as the upper superposition and I don't know how to improve it.
To test ImageFeatureTrack
I did the following:
ChoiceDialog[{FileNameSetter[Dynamic[imageDir], "Directory"],
Dynamic[imageDir]}];
SetDirectory[imageDir];
fNames = FileNames["*.png"];
numFiles = Length[fNames];
images = Table[Import[fNames[[i]], "PNG"], {i, 1, numFiles}];
{w, h} = ImageDimensions[images[[1]]];
res = ImageFeatureTrack[images,
Flatten[Table[{x, y}, {x, .5, w - .5, 56}, {y, .5, h - .5, 47}],
1]];
Graphics[{Blue,
If[FreeQ[#, _Missing], {Arrowheads[0.025], Arrow[{#}]}] & /@
Transpose[res]}, ImageSize -> {568, 478}]
The result shows in which direction the mean flow is oriented.
How can I extract from this the mean velocity in the different sectors?
I am also thinking about the Particle image velocimetry (https://en.wikipedia.org/wiki/Particle_image_velocimetry), but if something would be possible with functions implemented in Mathematica that would be great.