Pure AS3 version of Lucas-Kanade Optical Flow
Time for some playing.
As we tried to figure out how to get an accurate tracking using a webcam we stumbled upon different methods.
The first approach was using Haar Cascades. Trying to optimize them ended up in x-thousand lines of unrolled code in one function. I wrote an AIR app which transformed cascade xmls to a function AS3 class. Execution time was really good. If I remember right it was about 6ms for finding 2 eyes. But it was not accurate, found the eyes randomly. So we decided to skip Haar Cascades and tried to find another method which was more accurate.
We found OpenCV and the included lkdemo was what we thought would fit our needs. We did a complete rewrite in AS3 and optimized the hell out of it.
Optical Flow Demo (SWF) (webcam required)
On my machine it needs about 1ms per point + 2ms function overhead.
For optimisation we used Joas Apparat (http://blog.joa-ebert.com/) .