【发布时间】:2020-04-24 20:07:26
【问题描述】:
我正在使用 tesseract.js 进行 OCR,但是当我更改 exampleImage 时,我得到了这个错误。我根本找不到有关此错误的任何信息。提前谢谢你。
app.js
const exampleImage = 'https://d1q6f0aelx0por.cloudfront.net/product-logos/5431a80b-9ab9-486c-906a-e3d4b5ccaa96-hello-world.png';
const Tesseract=require('tesseract.js');
const worker = Tesseract.createWorker({
logger: m => console.log(m)
});
Tesseract.setLogging(true);
work();
async function work() {
await worker.load();
await worker.loadLanguage('eng');
await worker.initialize('eng');
let result = await worker.detect(exampleImage);
console.log(result.data);
result = await worker.recognize(exampleImage);
console.log(result.data);
await worker.terminate();
}
控制台日志
Error: Failed to detect OS
at ChildProcess.<anonymous> (c:\Users\jorda\AppData\Local\Programs\Microsoft VS Code\bin\Example\node_modules\tesseract.js\src\createWorker.js:173:15)
at ChildProcess.emit (events.js:311:20)
at emit (internal/child_process.js:876:12)
at processTicksAndRejections (internal/process/task_queues.js:85:21)
【问题讨论】:
标签: javascript node.js error-handling ocr tesseract