Skip to main content
February 8, 2016
Mobile

Optical Character Recognition (OCR) for Windows 10



Optical Character Recognition (OCR) is part of the Universal Windows Platform (UWP), which means that it can be used in all apps targeting Windows 10. With OCR you can extract text and text layout information from images. It’s designed to handle various types of images, from scanned documents to photos. At the same time, it is highly optimized and runs entirely on the device without requiring an Internet connection. The Windows 10 November update enables OCR for four new languages, bringing the total number of supported languages to 25.

This technology has been heavily tested inside Microsoft for years. It’s used in major products like Word, OneNote, OneDrive, Bing, Office Lens, and Translator for various scenarios, including image indexing, document reconstruction, and augmented reality.

Using the OCR API is very simple, as demonstrated by this code snippet:

[code lang=”csharp”]

SoftwareBitmap bitmap;

// …
// Acquire bitmap from file, camera, …
// …

OcrEngine ocrEngine = OcrEngine.TryCreateFromUserProfileLanguages();
OcrResult ocrResult = await ocrEngine.RecognizeAsync(bitmap);

string extractedText = ocrResult.Text;

[/code]

Running the code on the image below extracts the following text:

“TRAVEL THE WORLD SEE THE SIGHTS HAVE GREAT DAYS AND BETTER NIGHTS”

1_traveltheworld

OcrResult can be also used to retrieve text line by line or find position of each individual word. For more information, please check out the code sample at GitHub and MSDN documentation.

This work is the evolution of Microsoft OCR library for Windows Runtime, released on NuGet in 2014. If you used this library in an app for Windows/Windows Phone 8.1, moving to the new OCR API in Windows 10 will be straightforward.

In case you need to use OCR as a service, we’ve got you covered as well. The same technology is released as part of Project Oxford (a set of services for natural data understanding—we recommend you check it out as it brings a number of possibilities for your apps). Compared to the Windows.Media.Ocr namespace, the service has additional features such as language detection and text orientation detection. Try experimenting with the OCR service demo and get detailed info in the API documentation.

We’re looking forward to your new, amazing OCR-powered apps in the Windows Store. If you’d like to share feedback, ask a question, or start a discussion, please post on MSDN forum. We’ll be eagerly waiting to hear back from you!

Written by Pavle Josipovic, a Software Engineer on the Analog team