At the heart of the system is a deformable outline model of the hand, which has been constructed from a number of examples of hands in different positions. The hand is tracked from frame to frame using a non-trivial edge detection technique to drive the model towards the hand in the image. Full technical details can be found in Olivetti Research Limited Tech Report 95.1. Here's a snapshot of the tracker in action...
...and you can click here for a video clip (100Kb MPEG).
uncompress HandTrackerV2.1.tar.Z tar -xf HandTrackerV2.1.tarThis generates the handtracker directory with everything you need in it.
cd handtracker/demo trackerThis should bring up a window with the view from the IndyCam in it (reversed so it acts like a mirror). There is a hand template in the middle of the view. If you move your right hand up to the template it should `lock on' to your hand and follow it around from there. The tracker can only track your hand so long as the palm and all fingers are showing. If it thinks it has lost your hand it resets to the central position. If it's stuck on the wrong part of your hand, remove your hand from view and it will reset.
tracker -m ./hand-lin LThe L is necessary, but don't worry about its meaning!
tracker -trainAlong with the normal view there will be a smaller filter window, showing the image after colour filtering. It should look something like this:
There is good definition of the hand and it should track well. If it looks like either of these:
then it might be worth altering the colour filtering. The tracker has an auto-train facility for this. Hold your hand up to the IndyCam so that the whole of the small square is filled with hand-coloured pixels. Then (with your other hand) click the left mouse button. The pixels are sampled and a colour histogram is built. The new filter is then used in the filter window. You can take more samples by repeating this process. To clear the histogram and start again, click the middle button. When (if) you're happy, click the right mouse button to save the histogram (the filename used is tracker.hist).
To use your trained colour filter, type:
tracker -hist <histogram filename>Performance of the auto-trainer is sometimes marred by poor lighting or by the relatively low quality of the IndyCam. If you can't get good results by auto-training, you can manually alter the red/green/blue components of the colour filter to make it respond bettor to your skin tones. Try:
tracker -train -f <r> <g> <b>Where R, G and B are the three colour filter values (used additively, so the filtered greyscale value for a pixel with colour components r, g and b is r*R + g*G + b*B). The defaults are 4.0, -2.0 and -2.0 respectively which has the effect of highlighting red but damping white.
If you're still having problems there are two other measures. Firstly, find a source of ambient light (such as an anglepoise lamp) and position it to illuminate your hand. Secondly, go to a hardware store and buy some bright yellow rubber gloves. Then use the auto-trainer to respond to them. If this doesn't work, I don't know what will!
-m <model base filename> <model type L/P/H> is to specify the hand model filename. The only model available at the moment is hand-lin so there ain't much choice, but you can include the full or relative pathname if yours is different to ../models/hand-lin.
-v <number of variation modes> specifies the number of degrees of freedom in the variation of the mand model. The default is 4. Decrease to 3, 2, 1 or 0 for slight speed increase coupled with less robustness.
-i <number of iterations> is the number of tracking iterations per frame. There is a speed/performance tradeoff. Default is 4.
-step <value> alters the tracker sensitivity ie. how far the model can move per iteration. There is a tradeoff between speed and stability. Default is 1.0.
-rotate
-lefthand reverses the hand template for left handed use.
-overhead configures the tracker for use with an overhead camera pointing down onto a desktop.
-mouse puts the tracker in mouse pointer control mode. See below for details.
-outputpos outputs hand position info to stdout so you can pipe it into your own applications. See below for more details.
-train runs the tracker in `lighting condition training' mode. See `lighting conditions' below for details.
-hist <filename> specifies the colour histogram filename. See `lighting conditions' below for details.
-f <red filter value> <green filter> <blue filter> sets the colour filter values to suit your lighting conditions. See `lighting conditions' below for details. Defaults are 4.0, -2.0, -2.0.
-w <size> specifies the relative window size. Default is 1, other valid options are 2 and 0.5. Using a smaller window speeds up the tracker a bit since there are less pixels to write to the screen. Using a larger windows slows it down a lot.
-d <interval> dictates how frequently the IndyCam view is echoed to screen. Default is 1; increasing to 2 displays every other frame, 3 does every 3rd frame etc. This is purely to speed the tracker up by way of fewer screen-writes.
-r periodically outputs the frame rate.
-s outputs the number of model points which have `found an edge' in each frame.
-thicklines draws the hand outline thicker so it's more visible.
-noannotate suppresses the sizing circle and angle line which usually accompany the hand outline.
Using the hand tracker to control the mouse pointer
Yes! You can now control the mouse pointer without even touching the
mouse! Try:
tracker -mouseThe pointer moves with the position of your hand. You perform mouse button clicks by moving your thumb.
tracker -outputposThe tracker spurts position info to stdout which can be piped into you application or whatever. The format of the output is as follows:
X = <x coordinate of centre of hand> Y = <y coordinate of centre of hand> SIZE = <approximate width of hand in pixels, divided by two> ANGLE = <angle of hand to horizontal in degrees (upright is -90 deg)> DEFORM = <list of deformation parameters from which hand shape can be determined (default is 4 params, but can be overridden by -v switch)> THUMB_IN = <0 if the thumb is out, 1 if the thumb is in>I plan to include other parameters in a future version, such as the position of the thumb (`in' or `out'), so allow for unrecognized parameters in any code you write. Also, let me know if you have any special requests.
A more sophisticated way to link the hand tracker to your own applications has been developed by Richard Bowden; it's geared primarily towards (but not limited to) Inventor(TM) applications. Click here for more details.
Tony Heap - ajh@comp.leeds.ac.uk