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; }
private void btn_prep_Click(object sender, EventArgs e) { rich_status.Text += "Removing Image Noise...\n"; image = new Bitmap(pictureBox1.Image); Preprocesses.monochrome(image); //ConservativeSmoothing filter = new ConservativeSmoothing(); GaussianSharpen filter = new GaussianSharpen(4, 11); filter.ApplyInPlace(image); rich_status.Text += "Image Pre-processing Successful.\n"; pictureBox1.Image = image; }
public Processor() { initGlyphs(); // resizeFilter = new ResizeNearestNeighbor(1920, 1080); // resizeFilter = new ResizeBicubic(1920, 1080); resizeFilter = new ResizeBilinear(1920, 1080); gaussianFilter = new GaussianSharpen(4, 11); sharpenFilter = new Sharpen(); brightnessFilter = new ContrastCorrection(15); autoEvent = new AutoResetEvent(false); Thread thread = new Thread(process); thread.Start(); }
public static Bitmap GaussianSharpen(Bitmap bmp, int value, int kernel) { GaussianSharpen filter = new GaussianSharpen(value, kernel); filter.ApplyInPlace(bmp); return bmp; }
/// <summary> /// Sharpen using a gaussian sharpen filter. /// </summary> public static Bitmap Sharpen(this Bitmap bitmap) { if ((bitmap = bitmap.Channel()) != null) { var gaussianSharpen = new GaussianSharpen(); gaussianSharpen.ApplyInPlace(bitmap); } return bitmap; }
/// <summary> /// Sharpen using a gaussian sharpen filter. /// </summary> public static Bitmap Sharpen(this Bitmap Bitmap) { // Convert grayscale to RGB colour space. if ((Bitmap = Bitmap.Channel()) != null) { // Initialize a new instance of the GaussianSharpen class. var GaussianSharpen = new GaussianSharpen(); // Apply the filter to the image. GaussianSharpen.ApplyInPlace(Bitmap); } // Return the bitmap. return Bitmap; }