Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
Scripts Just JavaScript. No ASP.NET Jan 20, 2018
scripts Update OCR demo to use v2 of Computer Vision AAPI Jun 3, 2019

Cognitive Services Demo

Optical Character Recognition


This demo calls the OCR API, passing in an image containing text and returning the text in the image.


The following steps are required to run this sample code:

  1. Sign up for an Azure account
  2. Create a Computer Vision API key
  3. Create the getkey.js file


Sign up for an Azure account

You will need to install node to run this sample. You can download and install node from here.

Create a Computer Vision API key

You will need to create an API key for the Cognitive Service. To do this, sign up for an Azure account at You can sign up for a Free Account.

Create the getkey.js file

To protect the API key, I did not check in the getkey.js file. You will need to create this file in the root folder. Add the following code to getkey.js

var getKey = function () {
    return 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';

where xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx is your API key.

### Run the sample.

To run the sample, open index.html in a web browser.
You can’t perform that action at this time.