Sicos1977 / TesseractOCR

A .net library to work with Google's Tesseract
167 stars 21 forks source link

Is it supported on linux/centos ? #41

Closed TejasPatadiya10 closed 1 year ago

TejasPatadiya10 commented 1 year ago

Hi,

Recently we have been exploring different packages that supports OCR on linux and we have came across your package.

But when we ran it to linux/centos directly we are facing errors

so we want to know whether we need to perform any additional steps to run the same in the linux/centos

Sicos1977 commented 1 year ago

It should work because the code is written in .net core but I never tested it because I don't have any Linux. The only difference between Windows and Linux is that Linux uses the .so as extension for Tesseract so I think you somehow have to install the needed Tesseract libraries yourself because the nuget packag only has Windows DLL's in it with the .dll extension. You could try to rename them but I don't know if that works.

Sicos1977 commented 1 year ago

You could try to ask for some help in this issue --> https://github.com/Sicos1977/TesseractOCR/issues/35

I have used Linux in the past but that is ages ago so I don't know if I'm any help to you.

YoshiRulz commented 1 year ago

It looks like [RuntimeDllImport] and the rest of InteropDotNet is a custom reimplementation of P/Invoke and is actually cross-platform. (Our codebase also has one of these, pretty cool stuff.) It may be possible to have one package for both Windows and Linux just by changing these library filenames to leptonica-1.83.0 and tesseract53: https://github.com/Sicos1977/TesseractOCR/blob/c1225951128c6c6e59892ea88214eb5bfba33275/TesseractOCR/Interop/Constants.cs#L32-L33 The implementation for Linux wraps the argument to [RuntimeDllImport] in $"lib{p}.so", but doesn't remove .dll first (IIRC Mono's [DllImport] implementation is the same—very annoying). And the implementation for Windows will add back the .dll.

edit: w.r.t. WSL, you should be good to test in e.g. Debian WSL2 instead of a "real" VM.

YoshiRulz commented 1 year ago

Uhh? Is this wontfix?

Sicos1977 commented 1 year ago

Euh didn't read somewhere that I had to do something? I thought you were answering the question for the original issuer :-)