private void Effect()
 {
     IFilter imgeFilter = new BurkesDithering();
     Bitmap bitimg = new Bitmap(imgeFilter.Apply(img), 90, 111);
     btnCommon.Image = bitimg;
     imgeFilter = new GrayscaleBT709();
     btnGray.Image = new Bitmap(imgeFilter.Apply(img), 90, 111);
     imgeFilter = new Sepia();
     bitimg = new Bitmap(imgeFilter.Apply(img), 90, 111);
     btnSeperia.Image = bitimg;
     imgeFilter = new Invert();
     bitimg = new Bitmap(imgeFilter.Apply(img), 90, 111);
     btnInvert.Image = bitimg;
     imgeFilter = new Blur();
     bitimg = new Bitmap(imgeFilter.Apply(img), 90, 111);
     btnBlur.Image = bitimg;
     imgeFilter = new Texturer(new AForge.Imaging.Textures.MarbleTexture(10, 11), 0.7f, 0.3f);
     bitimg = new Bitmap(imgeFilter.Apply(img), 90, 111);
     btnJitter.Image = bitimg;
     imgeFilter = new ChannelFiltering(new IntRange(0, 0), new IntRange(0, 255), new IntRange(0, 255));
     bitimg = new Bitmap(imgeFilter.Apply(img), 90, 111);
     btnCyan.Image = bitimg;
     imgeFilter = new YCbCrExtractChannel(AForge.Imaging.YCbCr.CrIndex);
     bitimg = new Bitmap(imgeFilter.Apply(img), 90, 111);
     btnBlackWhite.Image = bitimg;
 }
Exemple #2
0
        private void RGBFilter_Clicked(object sender, RoutedEventArgs e)
        {
            if (mainPhoto != null)
            {
                chf = new ChannelFiltering();

                // set channels' ranges to keep
                chf.Red = new AForge.IntRange(int.Parse(RedIn.Text), int.Parse(RedOut.Text));
                chf.Green = new AForge.IntRange(int.Parse(GreenIn.Text), int.Parse(GreenOut.Text));
                chf.Blue = new AForge.IntRange(int.Parse(BlueIn.Text), int.Parse(BlueOut.Text));

                // apply the filter
                System.Drawing.Bitmap tmp = chf.Apply((System.Drawing.Bitmap)mainPhoto.Clone());
                //BitmapImage tmpBmpIs = ToBitmapImage(tmp);

                /*RenderTargetBitmap rtb = new RenderTargetBitmap((int)Photography.ActualWidth, (int)Photography.ActualHeight, mainPhoto.HorizontalResolution, mainPhoto, PixelFormats.Pbgra32);
                rtb.Render(Photography);

                PngBitmapEncoder png = new PngBitmapEncoder();
                png.Frames.Add(BitmapFrame.Create(rtb));
                MemoryStream stream = new MemoryStream();
                png.Save(stream);
                System.Drawing.Bitmap image = (System.Drawing.Bitmap)System.Drawing.Image.FromStream(stream);*/

                Photography.Source = ToBitmapImage(tmp);

                UpdateHistograms(tmp);
                UpdateChannelPreviews(tmp);
            }
        }