Socket
Socket
Sign inDemoInstall

ocr-preprocessor

Package Overview
Dependencies
13
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ocr-preprocessor

asynchronous image preprocessor based on OpenCV for OCR engine


Version published
Weekly downloads
7
increased by600%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

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.

Keywords

FAQs

Last updated on 01 Aug 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc