msys2 |arch pacman|ubuntu:tesseract ocr 安装 - 思源笔记自动调用

安装之后,思源笔记能自动调用,ocr识别图片中的文字,可被搜索到。

思源笔记 > 使用指南 > 资源文件 中有一些说明。

windows msys2安装

pacman -S ***tesseract***, 包括:软件本体&语言支持包

pacman -S mingw-w64-ucrt-x86_64-tesseract-ocr\
mingw-w64-ucrt-x86_64-tesseract-data-chi_sim \
mingw-w64-ucrt-x86_64-tesseract-data-chi_sim_vert \
mingw-w64-ucrt-x86_64-tesseract-data-chi_tra \
mingw-w64-ucrt-x86_64-tesseract-data-chi_tra_vert \
mingw-w64-ucrt-x86_64-tesseract-data-eng

# 语言包还有:
# osd: Orientation and script detection
# equ: Math / equation detection

设置环境变量:

  • PATH: tesseract.exe所在文件夹,比如C:\softwares\msys2\msys64\ucrt64\bin
  • TESSDATA_PREFIX:语言包所在文件夹,比如C:\softwares\msys2\ucrt64\share\tessdata

不设置这个可能导致ocr乱码

存在的问题:

  • 有时ocr不准
  • 有时不对某些图片执行ocr

ubuntu (20.04)

添加源安装最新的(5.4.1, 24.9.18)

sudo add-apt-repository ppa:alex-p/tesseract-ocr5
apt show tesseract-ocr # 查看版本
sudo apt install tesseract-ocr
tesseract -v  # 查看版本

下载语言包,https://tesseract-ocr.github.io/tessdoc/Data-Files.html
放到目标位置:/usr/share/tesseract-ocr/5/tessdata

猜你喜欢

转载自blog.csdn.net/weixin_44220976/article/details/139660448