easy-tesseract-ocr
v1.2.2
Published
This is a tiny OCR project and just provide a caller method to interact with Tesseract (Which is a known open source OCR library project written in C++).
Downloads
19
Maintainers
Readme
easy-tesseract-ocr
This is a tiny OCR project and just provide a caller method to interact with Tesseract (Which is a known open source OCR library project written in C++).
features
- OCR on static image (result in text or the value of probability)
- OCR on screen with specified region (result in text or the value of probability)
prerequisite
Download and Install the Tesseract OCR Engine: For more details, please refer to Github: https://github.com/tesseract-ocr/tesseract Windows binary(3-parties) and Trained data: https://sourceforge.net/projects/tesseract-ocr-alt/files/ For Windows user, you can install Tesseract OCR engine from this projecct directory(test/tesseract-3.02.02-chi_traineddata.7z) I have packed with the Traditional Chinese trained data.
command line test
Please make sure the Tesseract OCR engine can be called from command/unix cli. Window: \>tesseract -v (*the version number will be printed if Tesseract is set up correctly. If none of this, please make sure you have added the installation path to the PATH environment variable. Almost the default path should be C:\Program Files (x86)\Tesseract-OCR)
usage on Node (please refer to the /test/test[1-5].js for detailed usage)
npm install easy-tesseract-ocr --save
-- index.js
const eto = require('easy-tesseract-ocr');
console.log("\n-- test case 1: basic OCR scanning (english), eng-sample.png --");
eto.scan({
imagePath: './eng-sample.png',
trainedData: 'eng'
})
.then(function (text) {
console.log('[result]\n', text);
})
.catch(function (err) {
console.error(err);
});