一、概述
Tesseract.js 是一个 JavaScript 库,可以从图像中获取几乎任何语言的单词。
离线版:https://github.com/jeromewu/tesseract.js-offline电子版:https://github.com/jeromewu/tesseract.js-electron自定义训练数据:https://github.com/jeromewu/tesseract.js-custom-traineddataChrome 扩展 #1:https://github.com/jeromewu/tesseract.js-chrome-extensionChrome 扩展 #2:https://github.com/fxnoob/image-to-textFirefox 扩展:https://github.com/gnonio/korporize使用 Vue:https://github.com/jeromewu/tesseract.js-vue-app使用 Angular:https://github.com/jeromewu/tesseract.js-angular-app使用 React:https://github.com/jeromewu/tesseract.js-react-appTypescript:https://github.com/jeromewu/tesseract.js-typescript视频实时识别:https://github.com/jeromewu/tesseract.js-video
二、离线版
克隆
git clone https://github.com/jeromewu/tesseract.js-offline
依赖下载
yarn/npm install
启动访问http://127.0.0.1:3000/browser/index.html或者不启动直接对html文件进行Open with Live Server
npm run start
直接使用脚本运行英文示例
const { createWorker } = require('tesseract.js');
const path = require('path');
// 语言设置,单种语言识别
// chi_sim----eng
const language = 'eng'
const worker = createWorker({
langPath: path.join(__dirname, '..', 'lang-data'),
logger: m => console.log(m),
});
(async () => {
await worker.load();
await worker.loadLanguage(language);
await worker.initialize(language);
const { data: { text } } = await worker.recognize(path.join(__dirname, '..', 'images/en', 'demo_eurotext.png'));
console.log(text);
await worker.terminate();
})();
node .\node\index.js
识别其他语言chi_sim是中文
其他语言训练数据下载
下载后放置在lang-data应用后会解压
相关阅读
发表评论