Last active
August 23, 2016 17:31
-
-
Save tylernappy/06f8854ce9feb33191708688db1d1f17 to your computer and use it in GitHub Desktop.
Extract text from an image (OCR - optical character recognition) using Node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// install the official Haven OnDemand Node.js wrapper: https://github.com/HPE-Haven-OnDemand/havenondemand-node | |
// npm install --save havenondemand | |
var havenondemand = require('havenondemand') | |
var client = new havenondemand.HODClient('APIKEY') | |
// var data = {file: '/path/to/file.jpg', mode: 'document_photo', languages: ['en']} // uncomment if using a local file | |
var data = {url: 'https://www.havenondemand.com/sample-content/images/bowers.jpg', mode: 'document_photo', languages: ['en']} // uncomment if using a URL | |
client.post('ocrdocument', data, function(err, resp, body) { | |
var result = resp.body.text_block[0] | |
console.log(result) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment