Here is an example of using a gesture recognition library in Processing. The Gesture and Activity Recognition Toolkit (GART) is from http://wiki.cc.gatech.edu/ccg/projects/gt2k/gt2k.
It makes use of a Hidden Markov Model toolkit (HTK). Both training and recognition are supported.
In the above example, when you write with your mouse on the canvas, it matches the corresponding digit but it may be too small to be visible in the video.
Another video with clearer image.
