Created
February 21, 2018 21:31
-
-
Save adgaudio/f772004444dc808e900c057d45f8b52e to your computer and use it in GitHub Desktop.
Install tesseract and leptonica from source
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# This script installs leptonica and tesseract from source | |
# it does not install other pre-requisites to a custom location. | |
# side note: install prefix is defined once per library. | |
# side note: it clones git repositories in the current directory. | |
set -e | |
set -u | |
# install leptonica | |
( | |
export INSTALL_PREFIX=~/.sources | |
git clone https://github.com/DanBloomberg/leptonica.git | |
mkdir leptonica/build ; cd leptonica/build | |
cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX -DBUILD_PROG=1 .. | |
make -j8 | |
make install | |
) | |
# install tesseract | |
( | |
export INSTALL_PREFIX=~/.sources | |
git clone https://github.com/tesseract-ocr/tesseract.git | |
mkdir tesseract/build ; cd tesseract/build | |
PKG_CONFIG_PATH=$INSTALL_PREFIX/lib/pkgconfig cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX .. | |
make -j8 | |
make install | |
) | |
# install and test with tessdata | |
( | |
git clone https://github.com/tesseract-ocr/tessdata.git | |
tesseract --tessdata-dir ./tessdata -l heb ./tesseract/testing/hebrew.png out | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
tesseract percorso/al/tuo/file.png output.txt