charlesw / tesseract

A .Net wrapper for tesseract-ocr
Apache License 2.0
2.25k stars 741 forks source link

Tesseract.TesseractException: Failed to initialise tesseract engine #510

Open Justin8088 opened 4 years ago

Justin8088 commented 4 years ago

Thank you so much to come in trying to help me here.

I have installed Visual C++ Redistributable for Visual Studio 2015 on my x86 laptop.

I use visual studio 2013 to develop a win form project with a reference of tesseract 3.3.0 added from nuget [Also, I have set tesseract.dll to copy to local directory]

I followed the guidelines downloading all eng files and put them into a folder named tessdata and added in my project. download url is : https://github.com/tesseract-ocr/tessdata/archive/3.04.00.zip [Again, I have set all eng files copy to local directory]

I use following code to ensure that language data path does not end with a / or \ character.

string strTemplatePath = (new FileInfo(this.GetType().Assembly.Location)).DirectoryName; tessdata = Path.Combine(strTemplatePath, "tessdata");

I realize that language file must be the correct one for tesseract 3.3.0, otherwise it will not work.

However, on charlesw's page: https://github.com/charlesw/tesseract/ at "Getting started quickly section", he mention that "Download language data files for tesseract 3.05" but the link actually link to 3.04.00.zip instead.

The weird thing is that, when I tried it on debug mode, it works perfectly. However, if I deploy it to clickonce, the issue pops up: "Tesseract.TesseractException: Failed to initialise tesseract engine."

I have checked the page: https://github.com/charlesw/tesseract/wiki/Error-1 for details. trying to figure out any missing part for days with no luck.

Please help ....Any idea or suggestion is welcome here !

charlesw commented 4 years ago

Can you please provide log, see Error 1 for details on how.

Also can you clarify that when you said "tried it on debug mode, it works perfectly" do you mean that release build failed on the same machine or that your app failed when deployed to another machine using click once?

If it worked for debug but not release it probably means that your paths aren't what you expect (i.e. print out absolute tessdata path your passing in and \ or check the logs).

The 3.04 tessdata files are fine for 3.05 release of tesseract.