- Visual Studio with a C++17 compatible compiler (MSVC 19.15 or later)
- CMake >= 3.14
- Software Network SW client
-
Download the source code of latest Leptonica and Tesseract release. Here we use leptonica 1.83.1 an tesseract 5.3.3.
-
Extract the source to disk (
~\Documents\third_party\
for example).
- Download the latest release of SW client from here.
- Add path to SW client to system path.
- Run
sw.exe setup
as administrator.
-
Open terminal, navigate to leptonica source direcotry
cd ~\Documents\third_party\leptonica-1.83.1
-
Configure CMake project
cmake -B cmake-build-release -DCMAKE_BUILD_TYPE=Release cmake -B cmake-build-debug -DCMAKE_BUILD_TYPE=Debug
-
Build leptonica
cmake --build cmake-build-release --config Release cmake --build cmake-build-debug --config Debug
-
Install leptonica
By default, installation prefix is
C:\Program Fils (x86)\
, thus running powershell as administrator is required.cmake --install cmake-build-release cmake --install cmake-build-debug
-
Open powershell and navigate to tesseract source directory
cd ~\Documents\third_party\tesseract-5.3.3
-
Configure tesseract with cmake
cmake -B cmake-build-release -DCMAKE_BUILD_TYPE=Release -DSW_BUILD=ON -DOPENMP_BUILD=ON cmake -B cmake-build-debug -DCMAKE_BUILD_TYPE=Debug -DSW_BUILD=ON -DOPENMP_BUILD=ON
Note:
- If cmake complains about cannot find leptonica, add
-DLeptonica_DIR=/path/to/leptonica/cmake
to the configuratio command
- If cmake complains about cannot find leptonica, add
-
Build tesseract
cmake --build cmake-build-release --config release cmake --build cmake-build-debug --config debug
-
Install tesseract
Similar to leptonica, installing to default prefix requires running powershell as administrator.
cmake --install cmake-build-release cmake --install cmake-build-debug
-
Prepare tesseract pre-trained model data
- Download pre-trained English model from GitHub repo.
- Copy the downloaded model
eng.traineddata
toC:\Program Fils (x86)\tesseract\share\tessdata
- Modify environment variable to set
TESSDATA_PREFIX
to be the above mentioned director.
-
Clone the repository and navigate to the directory
-
Crate a build directory
mkdir build && cd build
-
Configure textspotter with cmake
cmake ..
If cmake cannot find package like OpenCV or Tesseract, add their respective path to cmake arguments like this:
cmake .. -DOpnCV_DIR="C:\opencv\build\x64\vc16\lib" -DTesseract_DIR="C:\Program Files(X86)\tesseract\lib\cmake"
-
Build textspotter
cmake --build .
-
Clone the repo and open with Visual Studio
-
Right click
CMakeLists.txt
and selectCMake Settings
. -
Add configurations
x64-Release
. -
Similar to powershell build, if package is not found, go to
CMake Settings
>Command arguments
>CMake command arguments
and add package dir manually. -
Click
Build
>Build All
on the top menu bar to build all target.