Пример #1
0
        public void TrackSkeleton(Body body, string uniqueKinectId)
        {
            if (body.IsTracked)
            {
                var skeletonTrack = new SkeletonTrack(body.TrackingId);

                foreach (var joint in body.Joints)
                {
                    if ((int)joint.Key < 13 || (int)joint.Key > 20)                        // exclude joints below the waist
                    {
                        var orientation = body.JointOrientations[joint.Key].Orientation.W; // not sure if JointOrientation XYZ are same/different than Joint XYZ
                        skeletonTrack.Add(joint.Value, orientation);
                    }
                }

                skeletonTrack.KinectDeviceId = uniqueKinectId;
                skeletonTrack.Location       = new LocationCoordinates
                {
                    Latitude  = float.Parse(ConfigurationManager.AppSettings["LocationLatitude"]),
                    Longitude = float.Parse(ConfigurationManager.AppSettings["LocationLongitutde"])
                };

                _eventHub.SendMessageToEventHub(skeletonTrack);
            }
        }
Пример #2
0
        private void SendIteraction(KioskStateEventArgs args)
        {
            var contentInteraction = new ContentInteraction();

            if (args.ContentAction == ContentAction.Exit)
            {
                var duration = contentInteraction.TimeStamp - _lastStateChange;
                contentInteraction.Duration = duration;
            }
            contentInteraction.Action     = args.ContentAction;
            contentInteraction.KioskState = args.KioskState;
            contentInteraction.TrackingId = args.TrackingID;

            contentInteraction.CorrelatedTrackingID = args.TrackingID;

            contentInteraction.DeviceSelection = args.ItemSelected ?? string.Empty;
            contentInteraction.InteractionZone = CurrentZone ?? string.Empty;
            contentInteraction.KinectDeviceId  = this._sensorService.Sensor.UniqueKinectId;
            contentInteraction.Location        = new LocationCoordinates
            {
                Latitude  = float.Parse(ConfigurationManager.AppSettings["LocationLatitude"]),
                Longitude = float.Parse(ConfigurationManager.AppSettings["LocationLongitutde"])
            };


            switch (args.ItemState)
            {
            case ManipulationStates.NoTrack:
                contentInteraction.DeviceSelectionState = DeviceSelectionState.NoTrack;
                break;

            case ManipulationStates.Released:
                contentInteraction.DeviceSelectionState = DeviceSelectionState.Released;
                break;

            case ManipulationStates.Removed:
                contentInteraction.DeviceSelectionState = DeviceSelectionState.DeviceRemoved;
                break;

            case ManipulationStates.Replaced:
                contentInteraction.DeviceSelectionState = DeviceSelectionState.DeviceReplaced;
                break;

            case ManipulationStates.Touched:
                contentInteraction.DeviceSelectionState = DeviceSelectionState.Touched;
                break;
            }

            contentInteraction.TimeStamp = DateTime.Now;

            if (_lastContentInteraction.InteractionZone != contentInteraction.InteractionZone || _lastContentInteraction.DeviceSelectionState != contentInteraction.DeviceSelectionState)
            {
                _lastContentInteraction = contentInteraction;

                _InteractionEventHub.SendMessageToEventHub(contentInteraction);
            }
        }
Пример #3
0
        private void SendKioskReportConfigurationToAzure()
        {
            //Send the KioskConfig to Azure for reporting purposes
            KioskReportingConfig rptConfig;

            var configEventHub = new EventHubMessageSender(ConfigurationManager.AppSettings["Azure.Hub.KioskConfig"]);

            using (StreamReader r = new StreamReader("KioskReportingConfig.json"))
            {
                string json = r.ReadToEnd();
                rptConfig = JsonConvert.DeserializeObject <KioskReportingConfig>(json);
            }
            var id = _sensorService.Sensor.UniqueKinectId;

            rptConfig.kinectID = id;
            configEventHub.SendMessageToEventHub(rptConfig);
        }
Пример #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);
            }
        }