Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,377 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi to all,
i'm executing one of the example for tesseract, i've compiled the source and put it in the assembly of the main project of the solution.
debugging step by step this code :
string testImagePath = "C:/Projects/Images/Grab.JPG";
string configurationFilePath = @"./tessdata";
using (var engine = new TesseractEngine(configurationFilePath, "eng", EngineMode.Default))
{
using (var img = Pix.LoadFromFile(testImagePath))
{
using (var page = engine.Process(img))
{
var text = page.GetText();
Console.WriteLine("Mean confidence: {0}", page.GetMeanConfidence());
Console.WriteLine("Text (GetText): \r\n{0}", text);
Console.WriteLine("Text (iterator):");
}
}
}
at this point : using (var engine = new TesseractEngine(configurationFilePath, "eng", EngineMode.Default))
i see that in this part of the code of tesseract (LibraryLoader of InteropDotNet.cs)
public IntPtr LoadLibrary(string fileName, string platformName = null)
{
fileName = FixUpLibraryName(fileName);
lock (syncLock)
{
if (!loadedAssemblies.ContainsKey(fileName))
{
if (platformName == null)
platformName = SystemManager.GetPlatformName();
Logger.TraceInformation("Current platform: " + platformName);
IntPtr dllHandle = CheckCustomSearchPath(fileName, platformName);
if (dllHandle == IntPtr.Zero)
dllHandle = CheckExecutingAssemblyDomain(fileName, platformName);
if (dllHandle == IntPtr.Zero)
if (dllHandle == IntPtr.Zero)
dllHandle = CheckCurrentAppDomainBin(fileName, platformName);
if (dllHandle == IntPtr.Zero)
dllHandle = CheckWorkingDirecotry(fileName, platformName);
if (dllHandle != IntPtr.Zero)
loadedAssemblies[fileName] = dllHandle;
else
throw new DllNotFoundException(string.Format("Failed to find library "{0}" for platform {1}.", fileName, platformName));
}
return loadedAssemblies[fileName];
}
}
the debug show me this information when it reach the comand in Bold (dllHandle = CheckCurrentAppDomain(fileName, platformName);)
the $exception.InnerException.Message contains this description : "Failed to find library "libleptonica-1.82.0.so" for platform x86."
Another thingh that is really strange to me is that in the code the leptonica library has searched with the name libleptonica-1.82.0.so, but in the project the leptonica library is named leptonica-1.82.0.dll, so why the code searchs for libleptonica-1.82.0.so?
Another question is, in the project i've seen that there are twi different directory where the libraries leptonica1820.dll and tesseract50.dll are installed that is :
C:\Users\USER.nuget\packages\tesseract\5.2.0\x86\leptonica-1.82.0.dll
and also direct in the project Tesseract, but in this directory : C:\Projects\Mobile\tesseract-master\tesseract-master\src\Tesseract\x86\leptonica1820.dll
What is the right directory ?
Could you please help me?
I work with VS19 Pro on Windows 10 Pro version 21H2
Many thanks in advance.
Genko