Example #1
0
        public void TryToDetect6890()
        {
            CaptchaDigit histohramDigit = new CaptchaDigit(_digit);
            histohramDigit.Median(0);
            histohramDigit.RemoveNoise(10);

            if ((histohramDigit.Digit.CropUnwantedBackground().Crop(new Rectangle(0, 20, 8, 7)).GetHistogram().Values[254] < 24) &&
                (histohramDigit.Digit.CropUnwantedBackground().Crop(new Rectangle(10, 19, 6, 4)).GetHistogram().Values[254] > 7) &&
                (histohramDigit.Digit.CropUnwantedBackground().Crop(new Rectangle(0, 13, 3, 8)).GetHistogram().Values[254] > 8))
            {
                _rather9 = true;
            }
            else if ((histohramDigit.Digit.CropUnwantedBackground().Crop(new Rectangle(15, 6, 7, 7)).GetHistogram().Values[254] < 22) &&
                    (histohramDigit.Digit.CropUnwantedBackground().Crop(new Rectangle(7, 13, 7, 7)).GetHistogram().Values[254] > 4) &&
                    (histohramDigit.Digit.CropUnwantedBackground().Crop(new Rectangle(0, 13, 3, 8)).GetHistogram().Values[254] > 12))
            {
                _rather6 = true;

            }
            else if (histohramDigit.Digit.CropUnwantedBackground().Crop(new Rectangle(7, 9, 7, 15)).GetHistogram().Values[254] > 10)
            {
                _rather8 = true;
            }
            else
            {
                _rather0 = true;
            }
        }
Example #2
0
        public Image Display6890()
        {
            CaptchaDigit histohramDigit = new CaptchaDigit(_digit);
            histohramDigit.Median(0);
            histohramDigit.RemoveNoise(10);
            Bitmap image = histohramDigit.Digit.CropUnwantedBackground();
            using (Graphics g = Graphics.FromImage(image))
            {
                if ((histohramDigit.Digit.CropUnwantedBackground().Crop(new Rectangle(0, 20, 8, 7)).GetHistogram().Values[254] < 24) &&
                    (histohramDigit.Digit.CropUnwantedBackground().Crop(new Rectangle(10, 19, 6, 4)).GetHistogram().Values[254] > 7) &&
                    (histohramDigit.Digit.CropUnwantedBackground().Crop(new Rectangle(0, 13, 3, 8)).GetHistogram().Values[254] > 8))
                {
                    g.FillRectangle(new SolidBrush(Color.White), new Rectangle(0, 20, 8, 7));
                    g.DrawRectangle(new Pen(Color.Red), new Rectangle(0, 20, 8, 7));
                    g.DrawString("9", new Font(FontFamily.GenericSansSerif, 5), new SolidBrush(Color.Black), new RectangleF(0, 22, 5, 6));

                }
                else if ((histohramDigit.Digit.CropUnwantedBackground().Crop(new Rectangle(15, 6, 7, 7)).GetHistogram().Values[254] < 22) &&
                    (histohramDigit.Digit.CropUnwantedBackground().Crop(new Rectangle(7, 13, 7, 7)).GetHistogram().Values[254] > 4) &&
                    (histohramDigit.Digit.CropUnwantedBackground().Crop(new Rectangle(0, 13, 3, 8)).GetHistogram().Values[254] > 12))
                {
                    g.FillRectangle(new SolidBrush(Color.White), new Rectangle(15, 6, 7, 7));
                    g.DrawRectangle(new Pen(Color.Red), new Rectangle(15, 6, 7, 7));
                    g.DrawString("6", new Font(FontFamily.GenericSansSerif, 5), new SolidBrush(Color.Black), new RectangleF(15, 6, 5, 6));

                }
                else if (histohramDigit.Digit.CropUnwantedBackground().Crop(new Rectangle(7, 9, 7, 15)).GetHistogram().Values[254] > 10)
                {
                    g.FillRectangle(new SolidBrush(Color.White), new Rectangle(7, 9, 7, 15));
                    g.DrawRectangle(new Pen(Color.Red), new Rectangle(7, 9, 7, 15));
                    g.DrawString("8", new Font(FontFamily.GenericSansSerif, 5), new SolidBrush(Color.Black), new RectangleF(8, 14, 5, 6));
                }
            }

            return image;
        }