Related to our optimized Face Tracker the application uses a bunch of Haar cascades, which are a bunch of numbers that describes the pattern to look for.
The haar cascades are generated from Haar training which is the method for training the application to look for a certain object, in this case it looks for faces.
Mario Klingemann converted the cascades to ActionScript instead of having to read from a big xml file.
There are people making new Haar cascades which might be better trained for faces, so if you want try other cascades then the ones Mario and we are using, we have a simple PHP script that converts an XML file to the actionscript we are using. Just copy the results into /jp/maas/HaarCascade.as
You will need SimpleXML on your server for it to work. It usually comes with the php installation.
$xml = simplexml_load_file('haarcascades.xml');
$stages = $xml->haarcascade_profileface->stages->_;
for($s = 0; $s < count($stages); $s++){
$trees = $stages[$s]->trees->_;
if($s == 0)
echo "
tree = firstTree = new FeatureTree(". $stages[$s]->stage_threshold.");";
else
echo "
tree = tree.next = new FeatureTree(". $stages[$s]->stage_threshold.");";
for($t = 0; $t < count($trees); $t++){
$r1 = str_replace(" ", ",", trim(substr($trees[$t]->_->feature->rects->_[0], 0, strlen($trees[$t]->_->feature->rects->_[0])-1)));
$r2 = str_replace(" ", ",", trim(substr($trees[$t]->_->feature->rects->_[1], 0, strlen($trees[$t]->_->feature->rects->_[1])-1)));
$th = $trees[$t]->_->threshold;
$lv = $trees[$t]->_->left_val;
$rv = $trees[$t]->_->right_val;
if($t == 0)
echo "feature = tree.firstFeature = new Feature2Rects($th, $lv, $rv, [$r1], [$r2]);";
else if($t == (count($trees) -1))
echo "feature.next = new Feature2Rects($th, $lv, $rv, [$r1], [$r2]);";
else
echo "feature = feature.next = new Feature2Rects($th, $lv, $rv, [$r1], [$r2]);";
}
}