简体   繁体   中英

Tessnet2 Could not load file or assembly 'tessnet2_64

Please dont mark -ve it is basic. Hi, In my visual studio2012 I am using tessnet2 library for ocr but unable to compile the code. I have seen http://www.pixel-technology.com/freeware/tessnet2/ and have made all settings. I placed the tessdata folder in my .exe directory also. I have Microsoft visual c++ 2008 redistributable packages also (both x86 and x64) installed. My system is 64bit. I have also tried only using x64 package by deleting x86. I am using .net4.5 in my setting. I also tried other framework in my project settings. I have also tried x86orx64 or both in my project settings. I have this code

Bitmap image = new Bitmap("C:\\Users\\Amna\\Documents\\text.tif");
tessnet2.Tesseract ocr = new tessnet2.Tesseract();
ocr.SetVariable("tessedit_char_whitelist", "0123456789"); // If digit only
ocr.Init(@"c:\temp", "fra", false); // To use correct tessdata
List<tessnet2.Word> result = ocr.DoOCR(image, Rectangle.Empty);
foreach (tessnet2.Word word in result)
Console.WriteLine("{0} : {1}", word.Confidence, word.Text);

but I get this error: Could not load file or assembly 'tessnet2_64, Version=2.0.4.0, Culture=neutral, PublicKeyToken=1550524b5ba07e29' or one of its dependencies. The system cannot find the file specified. I have seen these links as well Tessnet2 error in C# IIS 7.5 Fixing An attempt was made to load a program with an incorrect format problem? and many more.

Do you absolutely have to use the x64 version? I was having a lot of issue until I changed to using x86 version of the Tessnet2 (tessnet2_32.dll). I also changed my .NET framework target to 2.0. and making sure that the target platform is x86 architecture. I also had to make sure that I have the correct language data in tessdata folder where the program executable is. The data must also be a tesseract 2 data and not tesseract 3 data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM