Ejemplo n.º 1
0
        /// <summary>
        /// Fuses the api and local detection and renders the new picture
        /// </summary>
        /// <param name="frame">Frame to do so</param>
        /// <returns>New bitmapsource where stuff has been done</returns>
        private BitmapSource VisualizeResult(VideoFrame frame)
        {
            BitmapSource visImage = frame.Image.ToBitmapSource();
            //todo test
            LiveCameraResult result = _latestResultsToDisplay;

            if (result != null)
            {
                Rect[] clientFaces = frame.Rectangles;
                if (clientFaces != null && result.Faces != null)
                {
                    MatchAndReplaceFaceRectangles(result.Faces, clientFaces);
                }

                visImage = Visualization.DrawOverlay(visImage, result.Faces, result.EmotionScores);
            }

            return(visImage);
        }