将 tesseract 构建为 DLL 动态 link 库
Build tesseract as DLL Dynamic link library
我正在使用这个 .NET 包装器 https://github.com/charlesw/tesseract,我想更新包含的 tesseract 和 leptonica DLL,但经过长时间的 google 搜索后,我无法从原始 tesseract 生成它们和 leptonica github 存储库。
我已经在 charlesw 存储库上询问但没有得到任何回复 (https://github.com/charlesw/tesseract/issues/486)。
非常感谢任何有关如何构建 DLL 的帮助。
谢谢!
https://github.com/tesseract-ocr/tesseract
https://github.com/danbloomberg/leptonica
回答:(感谢user898678的link)
使用 bucket401 博客 post 教程我提取了生成所需的部分:
- leptonica-X.XX.X.dll
- tesseract.exe
- tesseractXX.dll
并创建了这个 buildTesseractLeptonica.bat :
mkdir buildTesseractLeptonica
cd buildTesseractLeptonica
mkdir bin
set INSTALL_DIR=%cd%
set PATH=%PATH%;%INSTALL_DIR%\bin
call "c:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Auxiliary\Build\vcvars64.bat" x64
set INCLUDE=%INCLUDE%;%INSTALL_DIR%\include
set LIBPATH=%LIBPATH%;%INSTALL_DIR%\lib
set TESSDATA_PREFIX=%INSTALL_DIR%\share\tesseract\tessdata
git clone --depth 1 https://github.com/DanBloomberg/leptonica.git
cd leptonica
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DCMAKE_PREFIX_PATH=%INSTALL_DIR% -DBUILD_PROG=OFF -DSW_BUILD=OFF -DBUILD_SHARED_LIBS=ON
cmake --build build --config Release --target install
cd ..
git clone --depth 1 https://github.com/tesseract-ocr/tesseract.git
cd tesseract
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DCMAKE_PREFIX_PATH=%INSTALL_DIR% -DLeptonica_DIR=%INSTALL_DIR%\lib\cmake -DBUILD_TRAINING_TOOLS=OFF -DSW_BUILD=OFF -DOPENMP_BUILD=OFF -DBUILD_SHARED_LIBS=ON
cmake --build build --config Release --target install
cd ..
bucket401 博客 post link: https://bucket401.blogspot.com/2021/03/building-tesserocr-on-ms-windows-64bit.html
我正在使用这个 .NET 包装器 https://github.com/charlesw/tesseract,我想更新包含的 tesseract 和 leptonica DLL,但经过长时间的 google 搜索后,我无法从原始 tesseract 生成它们和 leptonica github 存储库。
我已经在 charlesw 存储库上询问但没有得到任何回复 (https://github.com/charlesw/tesseract/issues/486)。
非常感谢任何有关如何构建 DLL 的帮助。
谢谢!
https://github.com/tesseract-ocr/tesseract https://github.com/danbloomberg/leptonica
回答:(感谢user898678的link) 使用 bucket401 博客 post 教程我提取了生成所需的部分:
- leptonica-X.XX.X.dll
- tesseract.exe
- tesseractXX.dll
并创建了这个 buildTesseractLeptonica.bat :
mkdir buildTesseractLeptonica
cd buildTesseractLeptonica
mkdir bin
set INSTALL_DIR=%cd%
set PATH=%PATH%;%INSTALL_DIR%\bin
call "c:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Auxiliary\Build\vcvars64.bat" x64
set INCLUDE=%INCLUDE%;%INSTALL_DIR%\include
set LIBPATH=%LIBPATH%;%INSTALL_DIR%\lib
set TESSDATA_PREFIX=%INSTALL_DIR%\share\tesseract\tessdata
git clone --depth 1 https://github.com/DanBloomberg/leptonica.git
cd leptonica
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DCMAKE_PREFIX_PATH=%INSTALL_DIR% -DBUILD_PROG=OFF -DSW_BUILD=OFF -DBUILD_SHARED_LIBS=ON
cmake --build build --config Release --target install
cd ..
git clone --depth 1 https://github.com/tesseract-ocr/tesseract.git
cd tesseract
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DCMAKE_PREFIX_PATH=%INSTALL_DIR% -DLeptonica_DIR=%INSTALL_DIR%\lib\cmake -DBUILD_TRAINING_TOOLS=OFF -DSW_BUILD=OFF -DOPENMP_BUILD=OFF -DBUILD_SHARED_LIBS=ON
cmake --build build --config Release --target install
cd ..
bucket401 博客 post link: https://bucket401.blogspot.com/2021/03/building-tesserocr-on-ms-windows-64bit.html