예제 #1
0
        public FrameByteBrightnessContrast(int brigtness, int contrast, bool preProcessFrames, int bitPix)
            : base(preProcessFrames, bitPix)
        {
            m_Brigtness = brigtness;
            m_Contrast  = (sbyte)contrast;

            uint maxPixelValue = bitPix.GetMaxValueForBitPix();

            Trace.Assert(maxPixelValue <= int.MaxValue, "32bit images not supported.");

            Pixelmap image = new Pixelmap((int)maxPixelValue + 1, 1, bitPix, new uint[maxPixelValue + 1], null, null);
            {
                for (int i = 0; i <= maxPixelValue; i++)
                {
                    image[i, 0] = (uint)i;
                }

                BitmapFilter.Brightness(image, m_Brigtness);
                BitmapFilter.Contrast(image, m_Contrast);

                for (int i = 0; i <= maxPixelValue; i++)
                {
                    m_MappedBytes[i] = image[i, 0];
                }
            }
        }
예제 #2
0
        private void filtercontrast_Click(object sender, EventArgs e)
        {//Contrasts Pictures Colors
            Parameter dlg = new Parameter();

            dlg.nValue = 0;

            if (DialogResult.OK == dlg.ShowDialog())
            {
                if (BitmapFilter.Contrast(image, (sbyte)dlg.nValue))
                {
                    this.Invalidate();
                }
            }
        }
예제 #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     BitmapFilter.Contrast(pirst, 100);
     progressBar1.Value += 2;
     BitmapFilter.GaussianBlur(pirst, 10);
     progressBar1.Value += 3;
     BitmapFilter.GrayScale(pirst);
     progressBar1.Value += 2;
     BitmapFilter.Threshold(ref pirst, ref sekond, 235);
     progressBar1.Value += 15;
     read();
     label1.Text       = "Done";
     pictureBox2.Image = sekond;
     show();
 }
예제 #4
0
        public FImageTest()
        {
            InitializeComponent();

            Invert.OnGetImage += (value) =>
            {
                var image = Properties.Resources.sample.Clone() as Bitmap;
                BitmapFilter.Invert(image);
                return(image);
            };

            Gray.OnGetImage += (value) =>
            {
                var image = Properties.Resources.sample.Clone() as Bitmap;
                BitmapFilter.GrayScale(image);
                return(image);
            };

            Brightness.OnGetImage += (value) =>
            {
                var bright = Properties.Resources.sample.Clone() as Bitmap;
                BitmapFilter.Brightness(bright, value);
                return(bright);
            };

            Contrast.OnGetImage += (value) =>
            {
                var c = Properties.Resources.sample.Clone() as Bitmap;
                BitmapFilter.Contrast(c, (sbyte)value);
                return(c);
            };

            var g = Properties.Resources.sample.Clone() as Bitmap;

            BitmapFilter.Gamma(g, RTracBar.Value, GTracBar.Value, BTracBar.Value);
            GammaRLabel.Text       = RTracBar.Value.ToString();
            GammaGLabel.Text       = GTracBar.Value.ToString();
            GammaBLabel.Text       = BTracBar.Value.ToString();
            Pict5.Image            = g;
            RTracBar.ValueChanged += (_s, _e) =>
            {
                if (Pict5.Image != null)
                {
                    Pict5.Image.Dispose();
                }
                var g2 = Properties.Resources.sample.Clone() as Bitmap;
                BitmapFilter.Gamma(g2, RTracBar.Value, GTracBar.Value, BTracBar.Value);
                Pict5.Image      = g2;
                GammaRLabel.Text = RTracBar.Value.ToString();
            };
            GTracBar.ValueChanged += (_s, _e) =>
            {
                if (Pict5.Image != null)
                {
                    Pict5.Image.Dispose();
                }
                var g2 = Properties.Resources.sample.Clone() as Bitmap;
                BitmapFilter.Gamma(g2, RTracBar.Value, GTracBar.Value, BTracBar.Value);
                Pict5.Image      = g2;
                GammaGLabel.Text = GTracBar.Value.ToString();
            };
            BTracBar.ValueChanged += (_s, _e) =>
            {
                if (Pict5.Image != null)
                {
                    Pict5.Image.Dispose();
                }
                var g2 = Properties.Resources.sample.Clone() as Bitmap;
                BitmapFilter.Gamma(g2, RTracBar.Value, GTracBar.Value, BTracBar.Value);
                Pict5.Image      = g2;
                GammaBLabel.Text = BTracBar.Value.ToString();
            };

            Smooth.OnGetImage += (value) =>
            {
                var image = Properties.Resources.sample.Clone() as Bitmap;
                BitmapFilter.Smooth(image, value);
                return(image);
            };

            Blur.OnGetImage += (value) =>
            {
                var image = Properties.Resources.sample.Clone() as Bitmap;
                BitmapFilter.GaussianBlur(image, value);
                return(image);
            };

            Removal.OnGetImage += (value) =>
            {
                var image = Properties.Resources.sample.Clone() as Bitmap;
                BitmapFilter.MeanRemoval(image, value);
                return(image);
            };

            Ave.OnGetImage += (value) =>
            {
                var image = Properties.Resources.sample.Clone() as Bitmap;
                BitmapFilter.ave(image, value);
                return(image);
            };

            Sharpen.OnGetImage += (value) =>
            {
                var image = Properties.Resources.sample.Clone() as Bitmap;
                BitmapFilter.Sharpen(image, value);
                return(image);
            };

            Emboss.OnGetImage += (value) =>
            {
                var image = Properties.Resources.sample.Clone() as Bitmap;
                BitmapFilter.EmbossLaplacian(image);
                return(image);
            };

            Edge.OnGetImage += (value) =>
            {
                var image = Properties.Resources.sample.Clone() as Bitmap;
                BitmapFilter.EdgeDetectQuick(image);
                return(image);
            };

            Median.OnGetImage += (value) =>
            {
                var image = Properties.Resources.sample.Clone() as Bitmap;
                BitmapFilter.MedianFilter(image);
                return(image);
            };

            Kuwahara.OnGetImage += (value) =>
            {
                var image = Properties.Resources.sample.Clone() as Bitmap;
                BitmapFilter.Kuwahara(image, value);
                return(image);
            };
        }