0.0.8 • Published 8 years ago

ocr-preprocessor v0.0.8

Weekly downloads
12
License
MIT
Repository
github
Last release
8 years ago

ocr-preprocessor

This is an asynchronous OCR preprocessor module for NodeJS.

Install

Use npm to install it by running :

npm install --save ocr-preprocessor

Note : This module is only compatible with Linux and OpenCV 2.X

Usage

Require the package

var preprocessor = require("ocr-preprocessor");

Use it on the image you want to process

let options = 
{ 
    blur: 3 , 
    threshold: 255 ,
    matrix: 7 ,
    constant: 5  
};
              
preprocessor("./test.jpg" , "./result.jpg" , options , function(err , path) {
  if (err) {
    console.log("Error !");
  }
  else {
    console.log("Preprocessed Image saved at : " + path);
  }
});

Exports

This module export itself as a single function

This function accept 4 arguments :

ArgumentDescriptionType
Input PathPath to the source imageString
Output PathPath to the destination imageString
OptionsOptions passed to preprocessing engineObject
CallbackCallback executed on returnFunction

Options

OptionDescriptionTypeDefault
blurBlur valueNumber0
thresholdThreshold valueNumber255
matrixThreshold matrix sizeNumber3
constantThreshold constantNumber5
revertRevert the imageBooleanfalse
isolateFind and isolate biggest areaBooleanfalse
deskewRun deskew algorithmBooleanfalse
matchCountDeskew sensibilityNumber100
ratioLine width threshold for deskewNumber2
lineStepMinimum line spacing for deskewNumber20

Note : ratio is used this way inside of the module :

image.width() / ratio;

Therefore , to select lined that are half the width of the image , ratio should be set to 2.

Asynchronous

This module is asynchronous. All the work is done outside of the node main loop. It allows you to preprocess a big amount of images at the same time.

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago