-
Notifications
You must be signed in to change notification settings - Fork 355
macOS Linux ‐ Support libraries for Tess4J Tesseract 4 OCR
If you got here automatically, then you have tried to use one of the SikuliX OCR features and got an error telling you, that the library libtesseract
is missing.
In the IDE it looks something like this:
[error] TextRecognizer: start: Tesseract library not found (libtesseract.dylib version 4.1.0)
[error] Save your work, correct the problem and restart the IDE!
[error] see: https://github.com/RaiMan/SikuliX1/wiki/macOS-Linux:-Support-libraries-for-Tess4J-Tesseract-4-OCR
[error] script [ testText ] stopped with error in line 2
[error] org.sikuli.script.SikuliXception ( org.sikuli.script.SikuliXception: fatal: TextRecognizer could not be initialized )
[error] --- Traceback --- error source first
line: module ( function ) statement
2: main ( <module> ) TextOCR.start()
[error] --- Traceback --- end --------------
The reason behind: The native libraries of the Tesseract package are only bundled with SikuliX for Windows, but have to be installed on macOS and Linux by the SikuliX user himself.
The following applies to SikuliX 2.0.4+
Tesseract for macOS
The recommendation is to install Homebrew as package manager, which should not make any problems on recent macOS versions.
Get the Tesseract installation by just running this in a Terminal window:
// version 4.1.3 is what is needed, and v5.x is too new.
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/bcbc5fcc61ede9c3e1c7c4d19763b4f91ce50bc3/Formula/tesseract.rb
brew install -s tesseract.rb
This might work as well with other package managers like MacPorts, Finch, ..., but is not tested.
Tesseract for Linux
You have to check, wether for your Linux flavour a package Tesseract is available, that installs the version 4.1.0+ libraries eventually including any development stuff.
After successful installation of Tesseract run this in a terminal window
tesseract -v
and you should get something like this:
tesseract 4.1.0
leptonica-1.78.0
libgif 5.1.4 : libjpeg 8d (libjpeg-turbo 1.5.2) : libpng 1.6.34 : libtiff 4.0.9 : zlib 1.2.11 : libwebp 0.6.1 : libopenjp2 2.3.0