public void SetResults(MaskType type, MaskResult result, ObjectPosition op)
        {
            this.DynamicThresholdCount = op.Counter;
            this.PercentMatch          = op.LastPercentMatch;

            this.SetResults(type, result);
        }
        private WriteableBitmap DrawMask(MaskResult mask)
        {
            var bitmap = new WriteableBitmap(mask.Width, mask.Height, 96, 96, PixelFormats.Bgr32, null);

            DrawImage(bitmap, mask);
            return(bitmap);
        }
        public async Task Run()
        {
            await Task.Run(() =>
            {
                Result = Mask.Run();
            });

            Image = new Image
            {
                Source = DrawMask(Result)
            };
        }
        public ColourMaskViewModel(BitmapImage bitmap, Head head, MaskResult frequentialMask)

        {
            _sampleWindow = new Rectangle(
                head.FaceArea.Left,
                head.HeadArea.Top,
                head.FaceArea.Width,
                head.FaceArea.Top - head.HeadArea.Top
                );

            Mask = new ColourMask(BitmapImageToBitmap(bitmap), _sampleWindow, frequentialMask);
        }
        public void SetResults(MaskType type, MaskResult result)
        {
            switch (type)
            {
            case MaskType.Dynamic:
            case MaskType.Static:
                this.IsMasked = true;
                break;

            case MaskType.Unknown:
            case MaskType.History:
                this.IsMasked = false;
                break;
            }

            this.MaskType = type;
            this.Result   = result;
        }
Beispiel #6
0
 public ColourMask(Bitmap image, Rectangle sampleWindow, MaskResult frequentialMaskResult)
 {
     _image = image ?? throw new ArgumentNullException(nameof(image));
     _frequentialMaskResult = frequentialMaskResult ?? throw new ArgumentNullException(nameof(frequentialMaskResult));
     _sampleWindow          = sampleWindow;
 }
 protected virtual void DrawImage(WriteableBitmap bitmap, MaskResult mask)
 {
     bitmap.WritePixels((x, y) => mask[x, y] ? Color.White.ToArgb() : Color.Black.ToArgb());
 }
        protected override void DrawImage(WriteableBitmap bitmap, MaskResult mask)
        {
            base.DrawImage(bitmap, mask);

            _sampleWindow
        }