1.0.3 • Published 9 years ago

smocr v1.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

SMOCR

NPM Interface to the SMOCR cloud OCR engine.

Reduce your OCR Backend setup time from weeks to minutes.

We currently support the following image formats: JPEG, PNG, TIFF (more to be added soon)

Pick one of our 3 OCR engines: Tesseract, SMOCR, Hybrid.

#SETUP


Get an API key from https://smocr.com

Install node module npm install smocr

You're good to go!

#CONFIGURE


Require Module: smocr = require('smocr');

Configure Module: smocr.key("YOUR_KEY");

#RUN


#Get string from image: This call returns a string containing all the recognized text.

options = {
	//local or http(s) path to image
	image: '/local/or/internet/path/to/image',
	//'tess' or 'smocr' or 'hybrid'
	engine: 'tess' 			
};
smocr.string(options, function(err, res){
	if(err){
		console.log(err);
		return;
	}
	if(res){
		//do something with res
	}
})

#Get wordboxes from image: This call returns an array of wordboxes. Each wordbox contains:

  • text: the text read from inside the box
  • conf: the confidence of the read value
  • box: {top, left, width, height} - coordinates of the wordbox
options = {
	//local or http(s) path to image
	image: '/local/or/internet/path/to/image',
	//'tess' or 'smocr' or 'hybrid'
	engine: 'tess' 			
};
smocr.boxes(options, function(err, res){
	if(err){
		console.log(err);
		return;
	}
	if(res){
		//do something with res
	}
})

#Check your quota:

smocr.quota(function(err, res){
	if(err){
		console.log(err);
		return;
	}
	if(res){
		//do something with res
	}
})