Believe it or not, Windows 10 comes with OCR capabilities out of the box. It’s actually very easy to use as well; admittedly, it’s not the most sensitive in the world – but it does basically work. Here’s how you would scan in a bitmap image and recognise characters:
public async string RecogniseOCR() { var ocrEngine = Windows.Media.Ocr.OcrEngine.TryCreateFromLanguage(new Windows.Globalization.Language("en")); var file = await Package.Current.InstalledLocation.GetFileAsync(@"Assets\test.bmp"); using (var stream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read)) { // Create image decoder. var decoder = await BitmapDecoder.CreateAsync(stream); // Load bitmap. var bitmap = await decoder.GetSoftwareBitmapAsync(); // Extract text from image. OcrResult result = await ocrEngine.RecognizeAsync(bitmap); // Return recognized text. return result.Text; } }
I scanned this image:
And it found this:
Like I said – not the most sensitive recognition in the world, but still, it’s there in Windows 10! What’s remarkable is that I only found it by accident – another example of Microsoft marketing missing a huge opportunity.