コード例 #1
0
        private bool IsNewUserAContinuation(PlayerBiometrics bioMetricData)
        {
            if (bioMetricData.FaceID != "")
            {
                var CheckList = from users in _playerBiometrics where users.FaceID == bioMetricData.FaceID orderby users.LastSeen select users;

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

                    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);
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
        public bool IsNewPlayer(ulong TrackingID)
        {
            _activePlayerBiometricData = (from player in _playerBiometrics where player.TrackingID == TrackingID select player).FirstOrDefault();

            if (_activePlayerBiometricData == null)
            {
                Debug.Print("IsNewPlayer: True " + TrackingID.ToString());
                return(true);
            }                                                         //Set things so we continue to see if we can identify this player...
            else if (_activePlayerBiometricData.SamplingCount < 5 || (IsPrimaryRoleBiometricID && _activePlayerBiometricData.FilteredBiometricData.FaceID == ""))
            {
                Debug.Print("IsNewPlayer: Sample " + TrackingID.ToString());
                return(true);
            }
            else
            {
                _activePlayerBiometricData.LastSeen = DateTime.Now;
                var t = _activePlayerBiometricData.FaceID;
                Debug.Print("IsNewPlayer: False " + TrackingID.ToString());
                return(false);
            }
        }
コード例 #3
0
ファイル: BiometricSampling.cs プロジェクト: cefoot/KAIT
        public async Task<bool> ProcessFace(ulong trackingId, WriteableBitmap bitmap)
        {
            System.Drawing.Bitmap bmp = CreateBitmap(trackingId, bitmap);
            Debug.Print("Process Face ");

            List<NEC.MAFunc.Wrapper.Face> result;

            if (!Properties.Settings.Default.TestMode)
                result = NEC.MAFunc.Wrapper.FaceAnalyser.DetectFace(bmp);
            else
                result = null;

            Debug.Print("Evaluate Demographics ");                                              //Male                             //Female
            if (Properties.Settings.Default.TestMode || (result != null && result.Count > 0 && (result[0].GenderConfidence > .7 || result[0].GenderConfidence < .3 )))
            {
                Debug.Print("Get Demographcis ");
                var current = GetDemographics(trackingId, result);


                if (current != null)
                {
                    // this should only occur if we are primarily in a Biometric authentication mode in which case we already processed 5 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 >= 4 
                        && _activePlayerBiometricData.Transmitted && current.FaceMatch)
                    {
                        Debug.Print("Update base on Biometric Auth. Resetting profile " + current.TrackingId.ToString());
                        _activePlayerBiometricData.ResetBiometricSamples();
                        _activePlayerBiometricData.Transmitted = false;
                        _activePlayerBiometricData.Add(current);
                    
                    }//Once we reach the 5 sample threshold and we're not in a contiuation we transmit the data to the subscribers
                    else if (_activePlayerBiometricData != null
                        && _activePlayerBiometricData.Transmitted == false 
                        && _activePlayerBiometricData.SamplingCount >= 4 
                        && !IsNewUserAContinuation(_activePlayerBiometricData))
                    {
                        Debug.Print("Returned Demographics " + current.TrackingId.ToString());
                        _activePlayerBiometricData.Add(current);
                        var PlaysTrueBiometrics = _activePlayerBiometricData.FilteredBiometricData;
                       
                        PlaysTrueBiometrics.TrackingState = BiometricTrackingState.TrackingStarted;

                        OnPlayerIdentified(PlaysTrueBiometrics);

                        _commClient.Send<IBiometricData>(PlaysTrueBiometrics, "biometrics");

                        if (!_cloudConnectionFailure)
                            await _dataBroker.SendAsync<IBiometricData>(PlaysTrueBiometrics);

                        _activePlayerBiometricData.Transmitted = true;
                    }
                    else
                    {
                        if (_activePlayerBiometricData == null)
                        {
                            Debug.Print("Added New Player " + current.TrackingId.ToString());
                            _activePlayerBiometricData = new PlayerBiometrics(current);
                            _playerBiometrics.Add(_activePlayerBiometricData);
                        }
                        else
                        {
                            Debug.Print("Added New Sample " + current.TrackingId.ToString());
                            _activePlayerBiometricData.Add(current);
                        }
                    }
                }

            }
            else
            {
                Debug.Print("Quality Issue Rejecting Image");
                if (Properties.Settings.Default.DebugImages)
                    bmp.Save("C:\\TEMP\\REJECTED" + trackingId + ".png", System.Drawing.Imaging.ImageFormat.Png);
            }

            return true;
        }
コード例 #4
0
ファイル: BiometricSampling.cs プロジェクト: cefoot/KAIT
        private bool IsNewUserAContinuation(PlayerBiometrics bioMetricData)
        {
            if (bioMetricData.FaceID != "")
            {
                var CheckList = from users in _playerBiometrics where users.FaceID == bioMetricData.FaceID orderby users.LastSeen select users;

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

                    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);
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
                else
                {

                    return false;
                }
            }
            else
            {
                return false;
                
            }

        }
コード例 #5
0
ファイル: BiometricSampling.cs プロジェクト: cefoot/KAIT
 public bool IsNewPlayer(ulong TrackingID)
 {
     _activePlayerBiometricData = (from player in _playerBiometrics where player.TrackingID == TrackingID select player).FirstOrDefault();
    
     if (_activePlayerBiometricData == null)
     {
         Debug.Print("IsNewPlayer: True " + TrackingID.ToString());
         return true;
     }                                                         //Set things so we continue to see if we can identify this player...
     else if (_activePlayerBiometricData.SamplingCount < 5 || (IsPrimaryRoleBiometricID && _activePlayerBiometricData.FilteredBiometricData.FaceID == ""))
     {
         Debug.Print("IsNewPlayer: Sample " + TrackingID.ToString());
         return true;
     }
     else
     {
         _activePlayerBiometricData.LastSeen = DateTime.Now;
         var t = _activePlayerBiometricData.FaceID;
         Debug.Print("IsNewPlayer: False " + TrackingID.ToString());
         return false;
     }
         
 }
コード例 #6
0
        public async Task <bool> ProcessFace(ulong trackingId, WriteableBitmap bitmap)
        {
            System.Drawing.Bitmap bmp = CreateBitmap(trackingId, bitmap);
            Debug.Print("Process Face ");

            List <NEC.MAFunc.Wrapper.Face> result;

            if (!Properties.Settings.Default.TestMode)
            {
                result = NEC.MAFunc.Wrapper.FaceAnalyser.DetectFace(bmp);
            }
            else
            {
                result = null;
            }

            Debug.Print("Evaluate Demographics ");                                              //Male                             //Female
            if (Properties.Settings.Default.TestMode || (result != null && result.Count > 0 && (result[0].GenderConfidence > .7 || result[0].GenderConfidence < .3)))
            {
                Debug.Print("Get Demographcis ");
                var current = GetDemographics(trackingId, result);


                if (current != null)
                {
                    // this should only occur if we are primarily in a Biometric authentication mode in which case we already processed 5 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 >= 4 &&
                        _activePlayerBiometricData.Transmitted && current.FaceMatch)
                    {
                        Debug.Print("Update base on Biometric Auth. Resetting profile " + current.TrackingId.ToString());
                        _activePlayerBiometricData.ResetBiometricSamples();
                        _activePlayerBiometricData.Transmitted = false;
                        _activePlayerBiometricData.Add(current);
                    }//Once we reach the 5 sample threshold and we're not in a contiuation we transmit the data to the subscribers
                    else if (_activePlayerBiometricData != null &&
                             _activePlayerBiometricData.Transmitted == false &&
                             _activePlayerBiometricData.SamplingCount >= 4 &&
                             !IsNewUserAContinuation(_activePlayerBiometricData))
                    {
                        Debug.Print("Returned Demographics " + current.TrackingId.ToString());
                        _activePlayerBiometricData.Add(current);
                        var PlaysTrueBiometrics = _activePlayerBiometricData.FilteredBiometricData;

                        PlaysTrueBiometrics.TrackingState = BiometricTrackingState.TrackingStarted;

                        OnPlayerIdentified(PlaysTrueBiometrics);

                        _commClient.Send <IBiometricData>(PlaysTrueBiometrics, "biometrics");

                        if (!_cloudConnectionFailure)
                        {
                            await _dataBroker.SendAsync <IBiometricData>(PlaysTrueBiometrics);
                        }

                        _activePlayerBiometricData.Transmitted = true;
                    }
                    else
                    {
                        if (_activePlayerBiometricData == null)
                        {
                            Debug.Print("Added New Player " + current.TrackingId.ToString());
                            _activePlayerBiometricData = new PlayerBiometrics(current);
                            _playerBiometrics.Add(_activePlayerBiometricData);
                        }
                        else
                        {
                            Debug.Print("Added New Sample " + current.TrackingId.ToString());
                            _activePlayerBiometricData.Add(current);
                        }
                    }
                }
            }
            else
            {
                Debug.Print("Quality Issue Rejecting Image");
                if (Properties.Settings.Default.DebugImages)
                {
                    bmp.Save("C:\\TEMP\\REJECTED" + trackingId + ".png", System.Drawing.Imaging.ImageFormat.Png);
                }
            }

            return(true);
        }