Détection des coordonnées d'un mouvement partir d'une webcam

cs_AcarnanDragoon Messages postés 55 Date d'inscription lundi 9 février 2009 Statut Membre Dernière intervention 3 octobre 2012 - 6 nov. 2009 à 16:26
 Quelcun159 - 18 mai 2013 à 20:48
Bonjour à tous,

Voila je cherche à obtenir les coordonnées d'un mouvement filmé à partir d'un webcam en Flash. Pour, par exemple, placé des boutons sur la scène et que les personne puissent les activés en bougeant devant leur web cam.

Le code suivant me permet de détecter la valeur du mouvement, me l'indique dans une progressBar, et avec un numericStepper on peut modifier la sensibilité de la caméra :

var my_cam:Camera = Camera.get();
var my_video:Video;
my_video.attachVideo(my_cam);

 
// configure the ProgressBar component instance
var motion_pb:mx.controls.ProgressBar;
motion_pb.mode = "manual";
motion_pb.label = "Motion: %3%%";
 
var motionLevel_lbl:mx.controls.Label;
// configure the NumericStepper component instance
var motionLevel_nstep:mx.controls.NumericStepper;
motionLevel_nstep.minimum = 0;
motionLevel_nstep.maximum = 100;
motionLevel_nstep.stepSize = 5;
motionLevel_nstep.value = my_cam.motionLevel;
 
// Continuously update the progress of the ProgressBar component instance to the activityLevel 
// of the current Camera instance, which is defined in my_cam 
this.onEnterFrame = function() {
     motion_pb.setProgress(my_cam.activityLevel, 100);
 };
 
// When the level of activity goes above or below the number defined in Camera.motionLevel, 
// trigger the onActivity event handler. 
my_cam.onActivity = function(isActive:Boolean) {
     // If isActive equals true, set the themeColor variable to "haloGreen". 
     // Otherwise set the themeColor to "haloOrange". 
     var themeColor:String = (isActive) ? "haloGreen" : "haloOrange";
     motion_pb.setStyle("themeColor", themeColor);
};
 
function changeMotionLevel() {
     // Set the motionLevel property for my_cam Camera instance to the value of the NumericStepper 
     // component instance. Maintain the current motionTimeOut value of the my_cam Camera instance. 
     my_cam.setMotionLevel(motionLevel_nstep.value, my_cam.motionTimeOut);
}
motionLevel_nstep.addEventListener("change", changeMotionLevel);


Auriez vous une idée ? voir même une solution ?

Merci dans tout les cas et bonne journée !

1 réponse

As tu trouvé une solution ? Je serais intéresser :)
0
Rejoignez-nous