Mac实现截图OCR输出文字功能
2024-10-21 10:07:20
为什么要这个功能
工作中会经常遇到需要识别一个图片中的文本内容,需要快速的OCR识别,从而提高工作效率;
如何实现
snipaste + pngpaste + tesseract
安装流程与使用
安装 pngpaste 和 tesseract 需要预先安装brew,国内安装brew可以参考brew官网直接执行/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
需要代理,且不一定一次成功,如果失败的话,需要多执行几次;
安装完brew后,需要更新brew brew udpate --verbose
, 如果遇到fatal: Could not resolve HEAD to a revision
, 进入到出问题的目录(笔者是/opt/homebrew/Library/Taps/homebrew/homebrew-core
目录),手动拉取代码
git fetch --prune origin
git pull --rebase origin master
成功之后,还需要设置brew的仓库镜像,可参考清华大学镜像
export HOMEBREW_API_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
export HOMEBREW_PIP_INDEX_URL="https://pypi.tuna.tsinghua.edu.cn/simple"
之后就可以安装pngpaste 和 tesseract,创建别名alias pocr='pngpaste - | tesseract stdin stdout'
,然后就可以进行截图,之后输入pocr
解析图片内容了
最新文章
- JS魔法堂:不完全国际化&;本地化手册 之 拓展篇
- centos 7.0 安装nginx 1.117
- 如何用Dummy实例执行数据库的还原和恢复
- [转] 《ES6标准入门》读书笔记
- final发布视频
- PHPExcel使用体会
- a[1000][1000]程序崩溃
- python (11)文件的读写 按行读文件
- oracle行列转换函数的使用
- HibernateTemplate 查询
- mongoDb c driver
- 工具-Quick time播放器
- Equilibrium point
- Redis与数据库同步问题
- python基于函数替换的热更新原理介绍
- 自己配置 vue 项目 知识体系(自己写脚手架 类似 vue-cli )
- centos7救援模式--单机模式(单用户模式)
- LG2634 [国家集训队]聪聪可可
- centos:时间同步
- MariaDB管理系统
热门文章
- 子路由path路径带 ‘/‘与不带
- MogDB 学习笔记之 -- 索引失效
- linux上安装python3(yum方式)
- Educational Codeforces Round 138 (Rated for Div. 2) - D. Counting Arrays
- Head_First_Python(中文版)值得花时间读的一本书
- 洛谷P8924题解
- Cinder 对接本地LVM存储
- Centos 7.9 部署Kubernetes集群 (基于containerd 运行时)
- 用CImage加载内存里的Image(转)
- vxWidgets(一):初识