How to split numbers from other lines in a CAPTCHA using AForge.Net

Since you see the picture below, I want to remove the circus.

enter image description here

enter image description here

Also I coded a method to detect circuls:

   // Create filter sequence and add filters
   FiltersSequence seq = new FiltersSequence();
   seq.Add(Grayscale.CommonAlgorithms.BT709);  // First, convert to grayscale
   seq.Add(new OtsuThreshold());               // Apply thresholding

   Bitmap grayImage = seq.Apply(myBitmapImage);

   Graphics g = Graphics.FromImage(grayImage);
   g.DrawImage(img, 0, 0);
  
   Pen redPen = new Pen(Color.Red, 2);
   Pen bluePen = new Pen(Color.Blue, 2);
   // check each object and draw circle around objects, which
   // are recognized as circles
   SimpleShapeChecker shapeChecker = new SimpleShapeChecker();

   for (int i = 0, n = blobs.Length; i < n; i++)
   {
       List<IntPoint> edgePoints = blobCounter.GetBlobsEdgePoints(blobs[i]);
       AForge.Point center;
       float radius;
       double completenessRatio;
       if (shapeChecker.IsCircle(edgePoints, out center, out radius))
       {
           g.DrawEllipse(bluePen,
               (int)(center.X - radius),
               (int)(center.Y - radius),
               (int)(radius * 2),
               (int)(radius * 2));

       }
   }
   bluePen.Dispose();
   redPen.Dispose();

   g.Dispose();

But it doesn’t work. How can I solve this issue?

  • Please explain what packages you are using?

    – 




  • @MehdiHaghshenas the packages that I’m using is Aforge.Net for processing images.

    – 

Leave a Comment