diff --git a/public_html/js/action-script.js b/public_html/js/action-script.js
index ca4df82..4f3c866 100644
--- a/public_html/js/action-script.js
+++ b/public_html/js/action-script.js
@@ -34,14 +34,17 @@
var process = function(){};
var exec = false;
var last;
- var trackerTask;
- var trackerTask;
+ var featureTrackerTask;
+ var faceTrackerTask;
+ var trackerCallback;
var Controller,
init,
- zones,
+ featureZones,
+ faceZones,
track,
- tracker,
+ featureTracker,
+ faceTracker,
initialized = false;
}
@@ -61,54 +64,62 @@ ControllerRememberer.fetch(function(loaded_data){
/* (1) Image par défaut */
this.src = 'front/male/1.jpg';
- /* (2) Attachement de dat.GUI */
+ /* (2) Initialization */
+ last = this.src;
+ initialized = true;
+
+ /* (3) Attachment to dat.GUI */
Controller.addFolder('Source Picture');
Controller.remember(this);
- Controller.add(this, 'src', this._images).listen();
-
- last = this.src;
-
- initialized = true;
+ Controller.add(this, 'src', this._images).listen();
};
/* (2) Gestion de tracking.js */
- zones;
+ featureZones = [];
+ faceZones = [];
/* (3) Gestion du track de l'image */
track = {
- track: function(){
- zones = [];
- trackerTask = tracking.track(_CAN, tracker);
+ trackFeatures: function(){
+ featureZones = [];
+ featureTrackerTask = tracking.track(_CAN, featureTracker);
+ },
+
+ trackFace: function(){
+ faceZones = [];
+ faceTrackerTask = tracking.track(_CAN, faceTracker);
}
};
- tracker = new tracking.ObjectTracker(['face', 'eye', 'mouth']);
+ /* (4) Initializing `Tracking.js` */
+ faceTracker = new tracking.ObjectTracker(['face']);
+ featureTracker = new tracking.ObjectTracker(['eye', 'mouth']);
- tracker.setStepSize(1.9);
+ faceTracker.setStepSize(1.5);
+ featureTracker.setStepSize(1.5);
- Controller.addFolder('Tracking.js');
- Controller.add(track, 'track');
+ trackerCallback = function(zones, e){
- tracker.on('track', function(event){
-
- event.data.forEach(function(rect){
+ zones.length = 0;
+ e.data.forEach(function(rect){
zones.push({
x: rect.x / _CAN.width,
y: rect.y / _CAN.height,
w: rect.width / _CAN.width,
h: rect.height / _CAN.height
});
-
});
- // On enregistre dans `zones` les zones trackées
+ // On enregistre dans `featureZones` les featureZones trackées
log('Recognition done', '[Tracking.js]');
- // On met à jour le rendu (affichage des zones)
- process.bind(DOM.imageLoader)();
+ // On met à jour le rendu (affichage des featureZones)
+ process.apply(DOM.imageLoader);
+ }
- });
+ faceTracker.on('track', function(e){ return trackerCallback.apply(this, [faceZones, e]); });
+ featureTracker.on('track', function(e){ return trackerCallback.apply(this, [featureZones, e]); });
}
@@ -125,9 +136,10 @@ ControllerRememberer.fetch(function(loaded_data){
/* [0.0] Gestion du changement d'image
=========================================================*/
if( this.src != last ){
- zones = [];
- exec = false;
- last = this.src;
+ faceZones = [];
+ featureZones = [];
+ exec = false;
+ last = this.src;
}
@@ -179,11 +191,12 @@ ControllerRememberer.fetch(function(loaded_data){
=========================================================*/
/* (1) On reporte chaque zone trackée sur le `