Windows 10, UWP, A Little More OCR

I shared this picture on Twitter of a little demo that I was writing for a talk where the PC (via the web cam) was reading a page of text;

and I got asked to share the source so I’m doing that here although the source is a little bit ‘rough and ready’.

I then looked up my old posts and realised that the code here is just an evolution of the code from this post so I won’t add too much here. Essentially, the way it works is something like;

    1. MainPage.xaml UI displays a CaptureElement, a Canvas and a TextBlock.
    2. The code behind MainPage.xaml.cs does;
      1. Creates a class I wrote called CameraPreviewManager which takes a reference to the CaptureElement and a filter to be applied to find the ‘best’ camera and then starts the previewing of video to the CaptureElement.
      2. Creates a class I wrote called OcrDetectionFrameProcessor which essentially runs a loop on a separate thread to pull preview frames from the camera, process them by using the OCR engine to gather some results and then fires a FrameProcessed event.
      3. Handles the FrameProcessed on the UI thread to draw the results to the screen as shown above.
  1. That’s pretty much it – code’s here for download, it’s a bit hacky so caveat emptor as usual Smile

4 thoughts on “Windows 10, UWP, A Little More OCR

  1. Thx, I may give this a try in an app I’m writing that could help read in part numbers off manufacture tags…I’ll take a close look later when I’m at an actual computer, but did you write your own ocr stuff or is that a separate library you reference that does the actual ocr work?

    • Hi,

      It’s really “neither” – the Windows 10 UWP platform has an OCR Engine built into it which I’m using here, it’s a fairly simple API where you feed it an image and it comes back with a set of results as to where it sees text in that image and what the text is.


Comments are closed.