The Video TurtleBoids Demo Applet is a Processing applet that captures video, derives optical flow vectors from it, and then uses the vectors to change the velocity of a flock of “boids” that can also draw lines (i.e., behave like Logo turtles). You will need the IgnoCodeLib library (the .jar file is included in the Code directory) and the ControlP5 library (not included, available for download at http://www.sojamo.de/libraries/controlP5/)
Based on Flocking, by Daniel Shiffman, in The Nature of Code, a demonstration of Craig Reynolds’ steering behaviors (see also http://www.red3d.com/cwr/). Also adapts code from Optical Flow by Hidetoshi Shimodaira from http://www.openprocessing.org/sketch/10435.
Download the VideoBoidsDemo. It will not run in a browser, and it does require a video input to function.