LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Implementing Tesseract DLL files in labview

Hey everybody 

 

I am tring to solve the task of making a small program that will use the dll files from google's tesseract project in a labview VI:
https://code.google.com/p/tesseract-ocr/

 

I want to compare the built in vision OCR to the performance of the Tesseract code and compare the two. 

 

 

Has anyone been successful in doing so? It seems no matter which version of the tesseract software I install it will not accept the dll files when trying to make a constuctor Node. 

The furthest I got was downloading some .net wrapper of nuget:

https://www.nuget.org/packages/Tesseract/

Building the project and then using the dll from that. Labview accepts this dll but I run into an error that says:

Error 1172 occurred at Constructor Node Error creating instance of TesseractEngine in assembly Tesseract.TesseractEngine, Tesseract, Version=2.4.1.0, Culture=neutral, PublicKeyToken=ebeb3d86bef60cbe, (System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
Inner Exception: System.DllNotFoundException: Failed to find library "liblept168.dll" for platform x86.)

 

 

0 Kudos
Message 1 of 13
(7,892 Views)

bump 🙂

0 Kudos
Message 2 of 13
(7,835 Views)

For anyone who stumbles on this post as I did, I had the same error, I have a solution. It took me a long time to figure out where Tesseract was looking for the DLLs when being run as an EXE. The LabVIEW build application puts DLLs into a sub directory called 'data'. This is fine for the 'Tesseract.dll' but liblept172.dll and libtesseract304.dll need to go in different directories. What I ended up doing was placing the x86 & x64 directories in the same directory as the executable. x86 & x64 contain the respective builds of liblept172.dll and libtesseract304.dll.

 

The directory structure ends up looking like this:

 

..\My Application\data\Tesseract.dll

..\My Application\x64\liblept172.dll

..\My Application\x64\libtesseract304.dll

..\My Application\x86\liblept172.dll

..\My Application\x86\libtesseract304.dll

..\My Application\My Application.exe

 

By the way the x64 directory is not required, I think because LV is x86. I just included it to help illustrate what's required.

 

I used a .Net wrapper for Tesseract that can be found here:

https://github.com/charlesw/tesseract

 

I followed, after a while, the troubleshooting steps contained in the Wiki there.

 

Message 3 of 13
(6,896 Views)

Hi ,

Is there any possibility of finding the text size using Tesseract DLL.

Please advice if any possibilities available.

 

 

0 Kudos
Message 4 of 13
(6,688 Views)

Hi Neilo,

 

Thank you for sharing the trick to place the dlls into the correct folder.

Do you have any LabVIEW example coded with this Tesseract wrapper API?

I realize that charlesw's git hub might have given the C# examples.

 

However, it still take some time to build up the IDE and to figure out the C# codes.

(Well, I am not even a Visual Studio programmer at all)

So it would be great if you can share some more experience on using the wrapper in LabVIEW.

 

Thanks.

 

0 Kudos
Message 5 of 13
(2,758 Views)

there exits a Tesseract.exe which can be used via Tesseract OCR Python within the LabView Python Node as shown here

0 Kudos
Message 6 of 13
(2,743 Views)

I know this is a bit late, but for anyone else who wants to pay around with it. I've cut this code out of my system so its not completely tested as-is. I have been using it for several years in my code. You need to point to the Tesseract data files and input an array of strings (paths) which are the images to be processed. The output is TXT files and an array of strings. I've forgotten how Tesseract is setup but hopefully you can figure out what is needed in the datapath from other Tesseract tutorials. You will obviously need the Tesseract DLL for the .net calls to work.

Message 7 of 13
(2,335 Views)

Hi Neilo,

Currently, I am working the tesseract related project.  I studied your content and used that code but i am not able to run. can you explain about how to connect the .NET and which version of LabVIEW and tesseract are you using? Plz share me your ideas it will be very useful for me.

 

 

Thankyou.

0 Kudos
Message 8 of 13
(2,036 Views)

The VI is saved in LV2015. The TesseractEngine .NET call is to Tesseract version 3.0.2.0.

 

You will likely need to double click the .NET Constructor and point to the DLL you have for Tesseract (click Browse)

 

I just tried to download the latest from nuget (rename .nuget to .zip) but I wasn't able to load it, I believe because I don't have the correct .NET Framework installed. That usually takes a bit of effort to get right.

 

What error do you get when you try and run it?

0 Kudos
Message 9 of 13
(2,026 Views)

Hi neilo,

Thanks for immediate response!

We have found the tesseract engine .Net. and right library file also. but still we have facing the different  issue. We tried to find it but, we are not able to find right solution.

Plz support me for finding the issue and guide me to complete the project.

Current labview version 2021 and tesseract 3.0.2.

And what we need give in the data path.

Below I have attached the image, plz check and help.

0 Kudos
Message 10 of 13
(1,993 Views)