This is implemented using OpenCV v1.
It's actually a simple combination of two of the samples that come with the library:
-Face Detect
-Feature Tracking.
Since Face Detection takes much more time & processing than Feature Tracking, it tracks the face on each frame but it only tries to detect a face every 100 milliseconds and then only in the currently tracked area. Red frame indicates an actual face detected, blue frame indicates just feature tracking so rapid flickering between red/blue is a good sign, solid blue not so much.
When it cannot detect a face it keeps tracking the dots until they degrade too much or too much time (1.5 seconds) elapses since last face was detected in which case it tries to find a new face in the whole picture.
Little kids love to play with this program as it is. They compete trying to get their face captured by the program and trying to take the capture from whomever has it.
It can be used as input to play games when coupled with GlovePie. It sends detection results to the IP indicated as the first parameter into port 54934 (hardcoded).
This is the old video where I was using two wiimotes to play N.O.L.F.