用 homebrew 安装了 tesseract,下载了语言包,用命令行可以识别图片中的文字。
tesseract -v
tesseract 5.3.0
leptonica-1.82.0
libgif 5.2.1 : libjpeg 8d (libjpeg-turbo 2.1.4) : libpng 1.6.39 : libtiff 4.4.0 : zlib 1.2.11 : libwebp 1.3.0 : libopenjp2 2.5.0
Found NEON
Found libcurl/7.86.0 SecureTransport (LibreSSL/3.3.6) zlib/1.2.11 nghttp2/1.47.0
List of available languages in "/opt/homebrew/share/tessdata/" (4):
chi_sim
eng
osd
snum
自己配置了 PATH 和 TESSDATA_PREFIX 环境变量,分别尝试在/etc/paths、/etc/profile、~/.bash_profile,中进行了设置:内容如下:
export TESSDATA_PREFIX=/opt/homebrew/Cellar/tesseract/5.3.0_1/share/tessdatat
下面是 path:
/opt/homebrew/bin /opt/homebrew/sbin /opt/local/bin /opt/local/sbin /usr/local/bin /System/Cryptexes/App/usr/bin /usr/bin /bin /usr/sbin /sbin /opt/homebrew/Cellar/tesserac /opt/homebrew/Cellar/tesseract/5.3.0_1/share/tessdatat
结果在 log 中一直看不到相关 ocr 日志:
* ver [2.7.10]
* arch [arm64]
* os [darwin 13.2.1]
* pid [582]
* runtime mode [prod]
* working directory [/Applications/SiYuan.app/Contents/Resources]
* read only [false]
* container [std]
* database [ver=20220501]
* workspace directory [/Users/ray/Documents/SiYuan]
I 2023/03/15 10:05:40 conf.go:327: user has enabled [Automatically upload error messages and diagnostic data]
I 2023/03/15 10:05:40 runtime.go:103: use network proxy [system]
I 2023/03/15 10:05:40 serve.go:108: kernel [pid=582] http server [127.0.0.1:49153] is booting
I 2023/03/15 10:05:40 blocktree.go:386: read block tree [3.0 MB] to [/Users/ray/Documents/SiYuan/temp/blocktree], elapsed [0.03s]
I 2023/03/15 10:05:40 working.go:395: built-in pandoc [ver=2.19.2, bin=/Users/ray/Documents/SiYuan/temp/pandoc/bin/pandoc]
I 2023/03/15 10:05:40 conf.go:636: database size [35 MB], tree/block count [504/9703]
I 2023/03/15 10:05:40 working.go:159: kernel booted
I 2023/03/15 10:05:40 box.go:75: auto stat [trees=504, blocks=9703, dataSize=463 MB, assetsSize=449 MB]
I 2023/03/15 10:05:40 disk.go:33: disk usage [total=494 GB, used=358 GB, free=136 GB]
I 2023/03/15 10:05:41 serve.go:121: reverse proxy server [127.0.0.1:6806] is booting
I 2023/03/15 10:05:46 sync.go:150: sync before boot
I 2023/03/15 10:05:47 repository.go:962: boot get sync cloud files elapsed [0.46s]
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于