Example #1
0
        private BitmapSource RenderFrame(VideoFrame frame)
        {
            // Draw any results on top of the image.
            BitmapSource visImage = frame.Image.ToBitmapSource();

            List <Player> players = _gameService.Players;

            if (players != null)
            {
                var clientFaces = (OpenCvSharp.Rect[])frame.UserData;
                //if (clientFaces != null && players.Count > 0)
                //{
                //    // If so, then the analysis results might be from an older frame. We need to match
                //    // the client-side face detections (computed on this frame) with the analysis
                //    // results (computed on the older frame) that we want to display.
                //    _gameService.ProcessLocalFaces(clientFaces);
                //}
                visImage = Visualization.DrawPlayers(visImage, players, _gameService.State);
                //visImage = Visualization.DrawScore(visImage, _gameService.Score);

                switch (_gameService.State)
                {
                case GameStateEnum.Started:
                    visImage = Visualization.DrawTime(visImage, _gameService.TimeElapsed);
                    break;

                case GameStateEnum.Finished:
                    visImage = Visualization.DrawResults(visImage, players);
                    break;

                default:
                    break;
                }
            }
            return(visImage);
        }
Example #2
0
        private ImageSource VisualizeTimer(bool drawIndicator)
        {
            // Draw any results on top of the image.

            return(Visualization.DrawTime(timerText, drawIndicator, round));
        }