private void _ThresholdButton_Click(object sender, RoutedEventArgs e)
        {
            int[]           bgr  = ParseBGR(_BGRTextBox.Text);
            ByteArrayBitmap rbmp = _bmp.Clone();

            byte[] truebyte  = new byte[] { 255, 255, 255 };
            byte[] falsebyte = new byte[] { 0, 0, 0 };

            numbergrid = new int[_bmp.Width, _bmp.Height];
            for (int x = 0; x < rbmp.Width; x++)
            {
                for (int y = 0; y < rbmp.Height; y++)
                {
                    byte[] c = rbmp.GetColor(x, y);
                    bool   t = true;


                    if (c[0] != bgr[0] || c[1] != bgr[1] || c[2] != bgr[2])
                    {
                        t = false;
                    }

                    rbmp.SetColor(x, y, t?truebyte:falsebyte);
                    numbergrid[x, y] = t ? 1 : 0;
                }
            }

            _image.Source = rbmp.ToBitmapSource();
        }
Beispiel #2
0
        public VideoFrame(ByteArrayBitmap bitmap, DateTime dbtime, bool clone)
        {
            if (bitmap == null)
            {
                throw new ArgumentNullException("bitmap");
            }

            ByteArrayBitmap bmp = (clone ? bitmap.Clone() : bitmap);

            this.Initialize(bmp, null, null, dbtime, false);
        }