我已经安装了tesseract OCR,它在语言列表中只有'eng'和'osd'。我需要德语。我厌倦了命令
brew install tesseract-ocr-deu
Run Code Online (Sandbox Code Playgroud)
但是我遇到了错误。
Error: No available formula with the name "tesseract-ocr-deu"
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.
Run Code Online (Sandbox Code Playgroud)
小智 12
在 mac OS 类型上
brew install tesseract-lang
Run Code Online (Sandbox Code Playgroud)
安装所有语言,您可以通过以下方式检查它们,
tesseract --list-langs
Run Code Online (Sandbox Code Playgroud)
我必须安装意大利语,但 tesseract-lang 安装成本为 164 个文件,654.0MB,并且提供不太精确的版本,速度更快,但效果最好,所以我决定手动安装
添加 shell 的路径(如果您在 Mac 上brew,请使用 查找您的路径brew info tesseract)
export TESSDATA_PREFIX=/usr/local/Cellar/tesseract/5.1.0/share/tessdata/
Run Code Online (Sandbox Code Playgroud)
更新个人资料(如果您处于zsh)
source ~/.zshrc
Run Code Online (Sandbox Code Playgroud)
在我的例子中保存语言best版本ita
wget -O $TESSDATA_PREFIX/ita.traineddata https://github.com/tesseract-ocr/tessdata/raw/main/ita.traineddata
Run Code Online (Sandbox Code Playgroud)
现在您应该看到添加的语言
tesseract --list-langs
Run Code Online (Sandbox Code Playgroud)
小智 6
为了完整起见,我添加了一个关于如何在 Linux 上通过 Tesseract OCR 安装和使用非英语语言的答案。由于这是我在谷歌上得到的第一个结果,我认为它可能对某人有所帮助。
在 Ubuntu/Debian 上安装德语:
$ sudo apt-get install tesseract-ocr-deu
Run Code Online (Sandbox Code Playgroud)
可以在此处找到所有支持语言的语言代码:
https://github.com/tesseract-ocr/tessdoc/blob/master/Data-Files-in-different-versions.md
要在 OCR 引擎中指定语言,请使用选项:-l lang,例如德语:
$ tesseract -l deu 'imagename' 'stdout'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4673 次 |
| 最近记录: |