0

With this code I can make a picture black and white. But how can I get the numbers from the picture into a label?

Bitmap BMP = new Bitmap("H:\\pelak.jpg");
Color col;
//int r, g, b, rgb;
byte blue, green, red;

for (int i = 0; i < Int32.Parse(BMP.Width.ToString()); i++)
{
    for (int j = 0; j < Int32.Parse(BMP.Height.ToString()); j++)
    {
        col = BMP.GetPixel(i, j);
        blue = col.B;
        green = col.G;
        red = col.R;

        if (red < 128)
        {
            BMP.SetPixel(i, j, Color.FromArgb(0, 0, 0));
        }
        if (red >= 128)
        {
            BMP.SetPixel(i, j, Color.FromArgb(255, 255, 255));
        }
    }
}
pictureBox2.Image = BMP; 
Guillaume
  • 12,824
  • 3
  • 40
  • 48
Aria5h4h
  • 75
  • 2
  • 2
  • 12

1 Answers1

1

OCR is not available in the .Net Framework, you are looking for an Optical character recognition (OCR) library. Or you may try to implement it but the task is hard.

You may try tesseractdotnet or find another library depending on your needs.

Guillaume
  • 12,824
  • 3
  • 40
  • 48
  • According to this link Tessnet2 depends on a buggy version with serious memory leaks. A version 3 as described in [this question](http://stackoverflow.com/questions/10067002/tesseract-3-ocr-net-wrapper) seems more advisable.. – TaW May 14 '14 at 10:36
  • What to do?what not to do My Friends? how can i get the source code? – Aria5h4h May 14 '14 at 14:00
  • @ILiya, click on tesseractdotnet link then `Tutorial` you may also try the sample application. Once you understand the Library, use your skills on your applicaiton. Otherwise try Google to find another OCR .Net component that may be easier to use. – Guillaume May 14 '14 at 14:48
  • tesseractdotnet : 403. That’s an error. Request not allowed from your country – Aria5h4h May 14 '14 at 19:30
  • @ILiya It works in my country. You may try to find another Library. – Guillaume May 15 '14 at 08:12
  • i want Something like this:[link](http://a.fsdn.com/con/app/proj/anpr/screenshots/gui1.jpg) – Aria5h4h May 17 '14 at 11:22