Exemple #1
0
        private void AddFacialLandmark(Face.FaceRectangle faceRect, Face.Coordinate coordinate, double scaleX, double scaleY, Rectangle rect)
        {
            double dotSize = 3;

            rect.Fill   = new SolidColorBrush(Colors.White);
            rect.Width  = dotSize;
            rect.Height = dotSize;
            rect.HorizontalAlignment = HorizontalAlignment.Left;
            rect.VerticalAlignment   = VerticalAlignment.Top;
            rect.RenderTransform     = new ScaleTransform {
                ScaleX = 1, ScaleY = 1
            };
            rect.Margin = new Thickness(
                ((coordinate.X - faceRect.Left) * scaleX) - dotSize / 2,
                ((coordinate.Y - faceRect.Top) * scaleY) - dotSize / 2,
                0, 0);
        }
        private static void AddFacialLandmark(Grid grid, Face.FaceRectangle rect, Face.Coordinate coordinate,
                                              double scaleX, double scaleY, SolidColorBrush color)
        {
            double    dotSize = 3;
            Rectangle b       = new Rectangle
            {
                Fill   = color,
                Width  = dotSize,
                Height = dotSize,
                HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top
            };

            b.RenderTransform = new ScaleTransform {
                ScaleX = 1, ScaleY = 1
            };
            b.Margin = new Thickness(
                ((coordinate.X - rect.Left) * scaleX) - dotSize / 2,
                ((coordinate.Y - rect.Top) * scaleY) - dotSize / 2,
                0, 0);
            grid.Children.Add(b);
        }