Esempio n. 1
0
        private bool IsNewUserAContinuation(PlayerBiometrics bioMetricData)
        {
            if (bioMetricData.FaceID != "")
            {
                var CheckList = from users in _playerBiometrics where users.Value.FaceID == bioMetricData.FaceID orderby users.Value.LastSeen select users;

                if (CheckList != null && CheckList.Count() > 1)
                {
                    var orginalRecord = CheckList.FirstOrDefault().Value;

                    var diff = DateTime.Now.Subtract(orginalRecord.LastSeen);


                    if (diff.Minutes == 0)
                    {
                        Debug.Print("I'VE SEEN YOU BEFORE " + orginalRecord.TrackingID.ToString() + " New ID " + bioMetricData.TrackingID.ToString());
                        _playerBiometrics.Remove(orginalRecord.TrackingID);
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        private bool IsNewUserAContinuation(PlayerBiometrics bioMetricData)
        {
            if (bioMetricData.FaceID != "")
            {
                var CheckList = from users in _playerBiometrics where users.Value.FaceID == bioMetricData.FaceID orderby users.Value.LastSeen select users;

                if (CheckList != null && CheckList.Count() > 1)
                {
                    var orginalRecord = CheckList.FirstOrDefault().Value;

                    var diff = DateTime.Now.Subtract(orginalRecord.LastSeen);


                    if (diff.Minutes == 0)
                    {
                        Debug.Print("I'VE SEEN YOU BEFORE " + orginalRecord.TrackingID.ToString() + " New ID " + bioMetricData.TrackingID.ToString());
                        _playerBiometrics.Remove(orginalRecord.TrackingID);
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return false;
                
            }

        }
Esempio n. 3
0
        public async Task <bool> ProcessFace(ulong trackingId, Bitmap bitmap)
        {
            //check to see if we've already processed this play to qualification so we can short cut processing...
            //this will occur as this process is happening on a paralle thread and we could be behind
            if (!IsNewPlayer(trackingId))
            {
                return(true);
            }

            //Jump out if we're in a fault condition
            if (_IsNECInFaultCondition)
            {
                return(false);
            }

            try
            {
                List <NEC.NeoFace.Engage.Face> result;


                if (!TestMode)
                {
                    result = NEC.NeoFace.Engage.NECLabs.DetectFace(bitmap);
                }
                else
                {
                    result = null;
                }


                //Male                             //Female
                if (TestMode || (result != null && result.Count > 0 && (result[0].GenderConfidence > .7 || result[0].GenderConfidence < .47) && result[0].GenderConfidence != -1.0))
                {
                    var current = GetDemographics(trackingId, result);

                    //This is implemented this way to maximize performance and avoid extra loops since it will only happen ONCE for every new user
                    try
                    {
                        _activePlayerBiometricData = _playerBiometrics[trackingId];
                    }
                    catch
                    {
                        _activePlayerBiometricData = null;
                    }

                    if (current != null)
                    {
                        // this should only occur if we are primarily in a Biometric authentication mode in which case we already processed  sensor reads to create the demographics profile.
                        // but there are some cases were we may still identify the user so we need to reset the profile is we suddenly recognize the person.
                        if (_activePlayerBiometricData != null &&
                            IsPrimaryRoleBiometricID &&
                            _activePlayerBiometricData.SamplingCount >= _overSamplingThreshold &&
                            _activePlayerBiometricData.Transmitted && current.FaceMatch)
                        {
                            _activePlayerBiometricData.ResetBiometricSamples();
                            _activePlayerBiometricData.Transmitted = false;
                            _activePlayerBiometricData.Add(current);
                        }//Once we reach the sample threshold and we're not in a contiuation we transmit the data to the subscribers
                        else
                        {
                            if (_activePlayerBiometricData == null)
                            {
                                _activePlayerBiometricData = new PlayerBiometrics(current);
                                _playerBiometrics.Add(_activePlayerBiometricData.TrackingID, _activePlayerBiometricData);
                            }
                            else if (_activePlayerBiometricData.SamplingCount < _overSamplingThreshold)
                            {
                                _activePlayerBiometricData.Add(current);
                            }

                            if (_activePlayerBiometricData.Transmitted == false &&
                                _activePlayerBiometricData.SamplingCount >= _overSamplingThreshold &&
                                !IsNewUserAContinuation(_activePlayerBiometricData))
                            {
                                var PlaysTrueBiometrics = _activePlayerBiometricData.FilteredBiometricData;

                                PlaysTrueBiometrics.TrackingState = BiometricTrackingState.TrackingStarted;
                                PlaysTrueBiometrics.FaceImage     = bitmap;

                                RaiseDemographicsEvent(PlaysTrueBiometrics);

                                OnPlayerIdentified(PlaysTrueBiometrics);

                                _eventHub.SendMessageToEventHub(PlaysTrueBiometrics);

                                _activePlayerBiometricData.Transmitted = true;
                            }
                        }
                    }
                }
                else
                {
                    Debug.Print("Quality Issue Rejecting Image");
                }

                return(true);
            }
            catch (Exception ex)
            {
                _IsNECInFaultCondition = true;
                OnDemographicsProcessingFailure(ex.Message + " " + ex.InnerException);
                return(false);
            }
        }
Esempio n. 4
0
        public async Task<bool> ProcessFace(ulong trackingId, Bitmap bitmap)
        {
            //check to see if we've already processed this play to qualification so we can short cut processing...
            //this will occur as this process is happening on a paralle thread and we could be behind
            if (!IsNewPlayer(trackingId))
            {
                return true;
            }

            //Jump out if we're in a fault condition
            if (_IsNECInFaultCondition)
                return false;

            try
            {
              
                List<NEC.NeoFace.Engage.Face> result;

               
                if (!TestMode)
                    result = NEC.NeoFace.Engage.NECLabs.DetectFace(bitmap);
                else
                    result = null;


                                                                                                 //Male                             //Female
                if (TestMode || (result != null && result.Count > 0 && (result[0].GenderConfidence > .7 || result[0].GenderConfidence < .47) && result[0].GenderConfidence != -1.0))
                {
                   
                    var current = GetDemographics(trackingId, result);

                    //This is implemented this way to maximize performance and avoid extra loops since it will only happen ONCE for every new user
                    try
                    {
                        _activePlayerBiometricData = _playerBiometrics[trackingId];
                    }
                    catch
                    {
                        _activePlayerBiometricData = null;
                    }

                    if (current != null)
                    {
                        // this should only occur if we are primarily in a Biometric authentication mode in which case we already processed  sensor reads to create the demographics profile.
                        // but there are some cases were we may still identify the user so we need to reset the profile is we suddenly recognize the person.
                        if (_activePlayerBiometricData != null
                            && IsPrimaryRoleBiometricID
                            && _activePlayerBiometricData.SamplingCount >= _overSamplingThreshold
                            && _activePlayerBiometricData.Transmitted && current.FaceMatch)
                        {
                          
                            _activePlayerBiometricData.ResetBiometricSamples();
                            _activePlayerBiometricData.Transmitted = false;
                            _activePlayerBiometricData.Add(current);

                        }//Once we reach the sample threshold and we're not in a contiuation we transmit the data to the subscribers
                        else
                        {
                            if (_activePlayerBiometricData == null)
                            {
                          
                                _activePlayerBiometricData = new PlayerBiometrics(current);
                                _playerBiometrics.Add(_activePlayerBiometricData.TrackingID, _activePlayerBiometricData);
                            }
                            else if (_activePlayerBiometricData.SamplingCount < _overSamplingThreshold)
                            {
                          
                                _activePlayerBiometricData.Add(current);


                            }

                            if (_activePlayerBiometricData.Transmitted == false
                                   && _activePlayerBiometricData.SamplingCount >= _overSamplingThreshold
                                   && !IsNewUserAContinuation(_activePlayerBiometricData))
                            {
                          
                                var PlaysTrueBiometrics = _activePlayerBiometricData.FilteredBiometricData;

                                PlaysTrueBiometrics.TrackingState = BiometricTrackingState.TrackingStarted;
                                PlaysTrueBiometrics.FaceImage = bitmap;

                                RaiseDemographicsEvent(PlaysTrueBiometrics);

                                OnPlayerIdentified(PlaysTrueBiometrics);

                                _eventHub.SendMessageToEventHub(PlaysTrueBiometrics);

                                _activePlayerBiometricData.Transmitted = true;
                            }
                        }


                    }

                }
                else
                {
                    Debug.Print("Quality Issue Rejecting Image");
                   
                }

                return true;
            }
            catch(Exception ex)
            {
                _IsNECInFaultCondition = true;
                OnDemographicsProcessingFailure(ex.Message + " " + ex.InnerException);
                return false;
            }
        }