{"id":13586010,"url":"https://github.com/Chandler-Lu/alfred-ocr","last_synced_at":"2025-04-07T14:33:15.532Z","repository":{"id":41092938,"uuid":"224166670","full_name":"Chandler-Lu/alfred-ocr","owner":"Chandler-Lu","description":"OCR \u0026 Translate using multiple interfaces for multi platform.","archived":false,"fork":false,"pushed_at":"2024-03-18T08:10:25.000Z","size":6050,"stargazers_count":221,"open_issues_count":0,"forks_count":22,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-03-19T08:55:29.944Z","etag":null,"topics":["alfred","cnocr","ocr","python","quicker","zxing"],"latest_commit_sha":null,"homepage":"https://www.yeslu.cn/archives/7fe802d0.html","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Chandler-Lu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-26T10:40:50.000Z","updated_at":"2024-08-01T16:32:01.220Z","dependencies_parsed_at":"2024-03-18T08:53:10.623Z","dependency_job_id":null,"html_url":"https://github.com/Chandler-Lu/alfred-ocr","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chandler-Lu%2Falfred-ocr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chandler-Lu%2Falfred-ocr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chandler-Lu%2Falfred-ocr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chandler-Lu%2Falfred-ocr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Chandler-Lu","download_url":"https://codeload.github.com/Chandler-Lu/alfred-ocr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223284982,"owners_count":17119818,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alfred","cnocr","ocr","python","quicker","zxing"],"created_at":"2024-08-01T15:05:16.331Z","updated_at":"2024-11-06T04:30:33.779Z","avatar_url":"https://github.com/Chandler-Lu.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Alfred - OCR and Translation\n\n## 下载地址\n\n[Github](https://github.com/Chandler-Lu/alfred-ocr/releases) | [Quicker (Windows)](https://getquicker.net/Sharedaction?code=f73ca43a-98c6-475d-a3cc-08d7c216a695)\n\n## OCR Demo\n\n![Demo_OCR][image-1]\n\n## Translate Demo\n\n![Demo_Trans][image-2]\n\n## 版本\n\n### 4.9.5\n\n- 同步 macOS Alfred 版本；\n- 优化代码；\n- 修复百度表格识别。\n\n### 4.9.2\n\n- 支持 CNOCR 基于 FastAPI 的 HTTP  [服务模式](https://github.com/breezedeus/cnocr#http%E6%9C%8D%E5%8A%A1)，您可以使用[此方法](https://github.com/Chandler-Lu/alfred-ocr/wiki/Q\u0026A#启用-cnocr-的-fastapi-服务模式-windows)注册 Windows 服务。\n\n### 近期更新\n\n- 百度 OCR 更换接口参数，已修复；\n- 支持 Mathpix 公式识别；\n- 删除腾讯优图接口，新增腾讯云文字识别接口（正式版）;\n- 由于可选识别方式过多，CNOCR 的触发方式修改为唯一触发词 `ooc (CNOCR)`。\n\n## 能力\n\n- 离线 OCR (CNOCR)\n- 通用 OCR (百度 | 腾讯 | Google)\n- 二维码识别 (百度 | ZXing)\n- 表格文字识别 (百度)\n- 数学公式识别 (百度 | Mathpix)\n- 多文件识别 (百度)\n- 文本翻译 (彩云小译)\n\n## 使用（必看！！）\n\n1. 这**不是**一个开箱即用的产品！\n2. 您至少要拥有 macOS Alfred 3 及以上版本并激活 Powerpack。\n3. 您需要安装 Python 3 及相应的依赖模块，并将 Python 3 路径填写在`PYTHON_PATH`处。\n4. 您需要申请并将对应接口的配置填入环境变量，部分接口附带我自己的 Key，但严禁滥用。\n5. 具体配置方法请移步 [安装方式][4]。\n\n## 依赖\n\n### 通用 OCR\n\n```bash\npip install requests==2.31.0\n```\n\n### CNOCR (离线 OCR)\n\n```bash\npip install cnocr[ort-cpu]==2.3\npip install cnocr[serve]==2.3 # 针对 FastAPI 服务模式\n```\n\n### ZXing (离线二维码识别)\n\n```bash\npip install zxing==1.0.1\n```\n\n## 接口\n\n### [CNOCR][5]\n\n#### 触发\n\n- 截图至剪贴板后使用关键词 `ooc` 触发。\n\n#### 说明\n\n- 一切安装方法请依据该项目 [README][6]。\n\n### [Baidu AI (百度)][7]\n\n#### 触发\n\n1. 通用 OCR：快捷键 ctrl+v 触发截图选框，或截图至剪贴板后使用关键词 `oob (baidu)` 触发；\n2. 二维码识别：截图后使用关键词 `ooqb (qr baidu)` 触发；\n3. 表格文字识别：截图后使用关键词 `ooe (excel)` 触发，识别后可直接复制至 Excel；\n4. 多文件识别：finder 中选中需要识别的图片并使用关键词 `oof (file)` 触发。\n\n![File_OCR][image-3]\n\n#### 说明\n\n1. 具备中英文识别，标点符号将被替换为对应语言下的符号；\n2. 二维码识别支持同时识别多个；\n3. 自带一个测试 Token，不保证可用性，需要稳定可自行申请；\n4. 最大支持单个 4MB 的图片。\n\n#### 自定义语种\n\n\u003e 目前仅通用 OCR 支持选择语言\n\n语种选择逻辑：\n\n1. ctrl+v 或关键词 `oob` 触发时，将选择环境变量中的 `baidu_language_type` 来定义语种。如果该值为空，则定义为默认值 `CHN_ENG`，即中英文混合识别；\n2. 当使用 `oob` 调出选择菜单，并按住 command 触发时，将使用第二语言识别。\n\n第一语言选择位置：\n\n![First_Lang_Select][image-4]\n\n第二语言选择位置：\n\n![Second_Lang_Select][image-5]\n\n\u003cdetails\u003e\n  \u003csummary\u003e支持的全部语种及其语种代码如下所示：\u003c/summary\u003e\n\n```\n- CHN_ENG：中英文混合\n- ENG：英文\n- JAP：日语\n- KOR：韩语\n- FRE：法语\n- SPA：西班牙语\n- POR：葡萄牙语\n- GER：德语\n- ITA：意大利语\n- RUS：俄语\n```\n\n\u003c/details\u003e\n\n### [Tencent (腾讯)][8]\n\n#### 触发\n\n- 通用 OCR：截图至剪贴板后使用关键词 `oot (tencent)` 触发。\n\n#### 说明\n\n1. 自带一个测试 Token，不保证可用性，需要稳定可自行申请；\n2. 最大支持 3MB 的图片。\n\n### [Google OCR][9]\n\n#### 触发\n\n- 通用 OCR：截图至剪贴板后使用关键词 `oog (google)` 触发。\n\n#### 环境变量\n\n| 变量名              | 字段说明                                         |\n| ------------------- | ------------------------------------------------ |\n| google_access_token | 授权密钥                                         |\n| google_post_referer | HTTP 请求时的 Referer 参数，默认为空             |\n| google_http_proxy   | HTTP 代理，默认为空，填写方式如 `127.0.0.1:1234` |\n\n#### 说明\n\n- Google OCR 为收费业务，需绑定信用卡，故本项目不带测试 Token，需要自行申请。\n\n### [Mathpix](https://mathpix.com)\n\n#### 触发\n\n- 公式识别：截图至剪贴板后使用关键词 `oom (mathpix)` 触发。\n\n#### 说明\n\n- Mathpix 为收费业务，需绑定信用卡，故本项目不带测试 Token，需要自行[申请](https://accounts.mathpix.com/ocr-api)。\n\n### [ZXing][10]\n\n#### 触发\n\n- 截图至剪贴板后使用关键词 `ooq` 触发。\n\n#### 说明\n\n1. 一切安装方法请依据该项目 [README][11];\n2. 仅支持单个二维码识别。\n\n### [彩云小译][12]\n\n#### 触发\n\n- 文本翻译：使用关键词 `tc (translate caiyun) + 需要翻译的内容` 来触发；输出结果可通过 `command + c` 复制。\n\n#### 说明\n\n1. 自带一个测试 Token，不保证可用性，需要稳定可自行申请；\n2. 支持中译英，及 X 译中(X 为彩云小译已经支持的语言类别)。\n\n## TODO\n\n- 段落优化\n- 截图翻译\n\n### 项目\n\n1. [breezedeus/cnocr][13]\n2. [dlenski/python-zxing][14]\n3. [ginfuru/alfred-screen-capture][15]\n4. [oott123/alfred-clipboard-ocr][16]\n\n### 用户\n\n感谢以下小伙伴帮助测试：\n\n1. [Elvis Cai][17]\n2. [LucasZhan](https://github.com/LucasZhan)\n\n[4]: https://www.yeslu.cn/archives/7fe802d0.html\n[5]: https://github.com/breezedeus/cnocr\n[6]: https://github.com/breezedeus/cnocr/blob/master/README.md\n[7]: https://ai.baidu.com/tech/ocr\n[8]: https://console.cloud.tencent.com/ocr/overview\n[9]: https://cloud.google.com/vision/docs/ocr\n[10]: https://github.com/dlenski/python-zxing\n[11]: https://github.com/dlenski/python-zxing/blob/master/README.md\n[12]: https://fanyi.caiyunapp.com/#/api\n[13]: https://github.com/breezedeus/cnocr\n[14]: https://github.com/dlenski/python-zxing\n[15]: https://github.com/ginfuru/alfred-screen-capture\n[16]: https://github.com/oott123/alfred-clipboard-ocr\n[17]: https://github.com/elviscai\n[image-1]: img/demo_ocr_cn.gif\n[image-2]: img/demo_trans.gif\n[image-3]: img/file_ocr.png\n[image-4]: img/first_lang_selection.png\n[image-5]: img/second_lang_selection.png\n[image-6]: img/jetbrains_logo.png\n[image-7]: img/ocr_abuse.png\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FChandler-Lu%2Falfred-ocr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FChandler-Lu%2Falfred-ocr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FChandler-Lu%2Falfred-ocr/lists"}