示例#1
0
        public AggregatedResult ProcessEvent(PipelineResult result)
        {
            Process(_faces, result.FacePositions.Length);

            if (!String.IsNullOrEmpty(result.FirstFaceLabel))
            {
                Process(_identified, result.FirstFaceLabel);
            }
            if (DateTime.Now - _check < _tick)
            {
                return(null);
            }

            var identified = GetWinner(_identified, MirrorStateMachine.NOBODY);
            var faces      = GetWinner(_faces, 0);

            _check = DateTime.Now;
            _identified.Clear();
            _faces.Clear();

            return(new AggregatedResult {
                Label = GetLabel(faces, identified),
                NumberOfFaces = faces
            });
        }
        private void UpdateScreen(Image <Bgr, byte> currentFrame, PipelineResult result)
        {
            foreach (var rec in result.FacePositions)
            {
                DrawFaceSquare(currentFrame, rec);
            }
            if (result.Status == FaceRecognitionStatus.IdentifiedUser)
            {
                DrawName(currentFrame, result.FacePositions[0], result.FirstFaceLabel);
            }
            var bitmapSource = ConvertToBitmapSource(currentFrame.Bitmap);

            bitmapSource.Freeze();
            ChangeUI(() => Video.Source = bitmapSource);
        }