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!

有帮助吗?

解决方案

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.

其他提示

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.

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().

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top