AForge.Imaging.Filters.FiltersSequence.Apply C# (CSharp) Method

Apply() public method

Apply filter to an image.
The method keeps the source image unchanged and returns the result of image processing filter as new image.
No filters were added into the filters' sequence.
public Apply ( Bitmap image ) : Bitmap
image System.Drawing.Bitmap Source image to apply filter to.
return System.Drawing.Bitmap
        public Bitmap Apply( Bitmap image )
		{
            Bitmap dstImage = null;
            // lock source bitmap data
            BitmapData imageData = image.LockBits(
                new Rectangle( 0, 0, image.Width, image.Height ),
                ImageLockMode.ReadOnly, image.PixelFormat );

            try
            {
                // apply the filter
                dstImage = Apply( imageData );
            }
            finally
            {
                // unlock source image
                image.UnlockBits( imageData );
            }

            return dstImage;
		}

Same methods

FiltersSequence::Apply ( BitmapData imageData ) : Bitmap
FiltersSequence::Apply ( UnmanagedImage image ) : UnmanagedImage
FiltersSequence::Apply ( UnmanagedImage sourceImage, UnmanagedImage destinationImage ) : void

Usage Example

示例#1
1
 private string reconhecerCaptcha(Image img)
 {
     Bitmap imagem = new Bitmap(img);
     imagem = imagem.Clone(new Rectangle(0, 0, img.Width, img.Height), System.Drawing.Imaging.PixelFormat.Format24bppRgb);
     Erosion erosion = new Erosion();
     Dilatation dilatation = new Dilatation();
     Invert inverter = new Invert();
     ColorFiltering cor = new ColorFiltering();
     cor.Blue = new AForge.IntRange(200, 255);
     cor.Red = new AForge.IntRange(200, 255);
     cor.Green = new AForge.IntRange(200, 255);
     Opening open = new Opening();
     BlobsFiltering bc = new BlobsFiltering();
     Closing close = new Closing();
     GaussianSharpen gs = new GaussianSharpen();
     ContrastCorrection cc = new ContrastCorrection();
     bc.MinHeight = 10;
     FiltersSequence seq = new FiltersSequence(gs, inverter, open, inverter, bc, inverter, open, cc, cor, bc, inverter);
     pictureBox.Image = seq.Apply(imagem);
     string reconhecido = OCR((Bitmap)pictureBox.Image);
     return reconhecido;
 }
All Usage Examples Of AForge.Imaging.Filters.FiltersSequence::Apply