I just discovered a piece of freeware that seems to be able to used with programs like UltraHal, it's vb scriptable and works with most webcams, check out http://www.roborealm.com . The software is designed for integrating with robots, but shape recognition and pattern matching would be useful with an AI program too.