PROCEDURE FOR "FLOW MAPPING"
Assuming you already have a bitmap object to "map the flow" of ...
Establish a radius (how far around each point you want to use), and decide how many inbetween circles you want to test.
int radius = 10;
int subpixels = 3;
Make a new bitmap object:
flowtest = new bitmap(360, radius*subpixels);
Make sure that testx and testy are at *least* radius pixels away from any edge of the original picture.
Fill "flowtest" by grabbing from the original picture such that the direction away from (testx,testy) is x, and the distance away from (testx, testy) is (y+1)/subpixels. Also, dim to black as you reach further out, since we wish to gradually lessen the impact as we move further from the test point:
value = (1.0 - float(y)/float(radius*subpixels))*value;
Make a score card:
long int score[180];
Testing each degree will involve comparing the "flowtest" image with itself using a horizontal flip and a series of horizontal offsets. I'm very unsure of the correctness of the following pseudo-code; I know that testing 0 degrees should yield the same results as testing 180 degrees, but when I try to demonstrate this to myself with my hands, it doesn't work visually. Furthermore, what this really tests for is mirroring rather than flow (the assumption being that if there is flow, it is perpendicular to any mirroring). Here's what I have for now, correct or not:
For each degree D (0 thru 179),
initialize score[D] to zero
for each column C (0 thru 359) on flowtest,
CH is column ((360 - C) + D)%360
for each pixel in C and CH,
score[D] += (abs(r1-r2) + abs(g1-g2) + abs(b1-b2));
It's important to note that, like in golf, lower scores are better. The score which is the lowest is officially the direction of "flow" for (testx, testy). However you still need another value representing the significance of that, since some areas have more of a sense of direction than others.
long int relevance = 0;
For each degree D (0 thru 179),
relevance += (score[degree] - score[winningdegree])
Unfortunately there will be no way to know what this "relevance" value means without comparing it to the "relevance" at several other locations in the picture. After that point you can determine a range, and rescale all the "relevance" values to a nice, neat 0-255. In the interim, you may need an array of long ints or even floats to hold the unscaled values. I don't know how big these numbers will get.
Probably a good way to display it graphically would be to use flow direction and flow relevance as hue and saturation values, with brightness at a constant 255. This way, the areas with more flow will show up as colored areas on a white background (you will probably want to rescale direction from 180 degrees to 255 "pseudo-degrees" so that as things curve, they change hue continuously).