Пример #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;
 }
Пример #2
0
        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;
        }
Пример #3
0
        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();
        }
Пример #4
0
 public static Bitmap GaussianSharpen(Bitmap bmp, int value, int kernel)
 {
     GaussianSharpen filter = new GaussianSharpen(value, kernel);
     filter.ApplyInPlace(bmp);
     return bmp;
 }
Пример #5
0
		/// <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;
		}
Пример #6
0
 /// <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;
 }