4

I need to do an OCR of a .jpg image. I searched a lot and finally get the "tessnet2". The code looks pretty simple but I have a problem with the example :l

When I try to init the ocr, my application quits and didnt return anything. Debuging, looks like the next line is where it exits:

ocr.Init("C:\\Desarrollo\\Prueba\\ConsoleApplication1\\tessdata", "spa", false);

The first parameter its the path with "tessdata" included, isnt it? The second path is the lenguage that i want to use...

In tessdata i have the 8 files it needs.

What Im doing wrong?

Im using c# and visual studio 2010. When i try to compile it, i get an error of .net framework (i was using 4.0 and it needs 2.0, i decrease it and now compile but i get that problem).

Thanks!

FrioneL
  • 943
  • 2
  • 13
  • 19

3 Answers3

9

I encountered the same problem, but I found out that I had been using the language file for Tesseract 3.0 (not 2.0). When I put the files intended for 2.0, it worked.

Since you also seem to be using 2.0 SDK, download the language files for the 2.0 (http://code.google.com/p/tesseract-ocr/downloads/list). Files at the top are for 3.0. Scroll to the bottom of the list.

ravinsp
  • 4,150
  • 2
  • 32
  • 43
  • Thanks for the answer but I already correct it. My problem was with registry. Seems that after install tesseract 3.0, there were some problems... But I use a registry cleaner program and it works! – FrioneL Aug 08 '11 at 10:26
1

I too encountered the same issue where the method tessnet2.Tesseract ocr = new tessnet2.Tesseract(); ocr.Init(@"E:\QAliber\qaliber-code-133\QAliber Engine\OCR\" + @"tessdata\", "eng", false);

was failing at Init() method. It didn't throw me any error but the execution simply exited with exit code 1. In order to fix the issue, I downloaded eng language files from the correct version (2.0 for me) and deleted all the keys in registry where I found the key word "tesseract". Then I rebooted the machine. It program executes successfully now. The only issue now is that I don't get proper result (height is negative). I will take a look at it. But I am happy that atleast my program executes.

  • I have been struggling to run my version of tessnet2. Can you help me out with a sample application solution or the location and exact names of the language files and dlls you are using? – Sandy Jun 10 '13 at 11:44
0

My code is working fine in other machines but not working in one machine. I am using VS2010 and framework 3.5. Control is automatically out from below code:

ocr.Init(@"D:\path", "eng", false);

Here ocr is the instance of Tesseract().

Kanwar
  • 21
  • 4