Every digital photo is a 2D array of pixels each with a red, green and blue component, in the range 0-255.
Suppose you placed an image in the xy-plane and created a vector field in R3 based on the r, g, b components of each pixel.
Then, let the image define the following functions:
- r(x,y) = the number (0-255) that represents the red component of the pixel at (x,y) in the image
- g(x,y) = the number (0-255) that represents the green component of the pixel at (x,y) in the image
- b(x,y) = the number (0-255) that represents the blue component of the pixel at (x,y) in the image
This would let us define the vector field as.
F(x,y,z)=(r(x,y)-128, g(x,y)-128, b(x,y)-128)
128 is subtracted from each value so that the resulting vector components could be either positive or negative. (Pixel color components are always non-negative.)
The program I created shows the flowlines of a particle in the vector field F. Each line is colored according to the color of the pixel at which its path starts.
All starter images are either from Wikimedia Commons and are in the Public Domain or are original photos taken by me.
Download the program here. And open it in Netlogo 3D.
See the starter photos and result screenshots here.