예제 #1
0
        void _recognizer_RecognitionCompletedEvent(System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            IsRecognizing = false;
            if (e.Cancelled)
            {
                _trackingEngine.RecognitionResult(null);
                return;
            }

            var users = e.Result as Dictionary <string, float>;

            var bestMatch = "";
            var bestConf  = 50f;

            foreach (var user in users)
            {
                if (user.Value > bestConf)
                {
                    bestMatch = user.Key;
                    bestConf  = user.Value;
                }
            }

            if ("".Equals(bestMatch))
            {
                _trackingEngine.RecognitionResult(null);
                return;
            }

            bestMatch = bestMatch.Replace("@homerKinect.com", "");

            //Log.Info(bestMatch);

            User userF = new User();

            userF.Name           = bestMatch;
            userF.FaceConfidence = bestConf;

            userF.TrackingID = _skelToMatch.TrackingId;

            userF = _featureDetector.ValidateUser(userF, _skelToMatch);



            _trackingEngine.RecognitionResult(userF);
        }