OcrControl.CaptureFrame() Method


Deprecated. The CaptureFrame() Method captures an image frame from the camera and sends it to the Bing Optical Character Recognition (OCR) Service for processing. The default OcrControl UI calls this method when a user clicks or taps the preview window.

Published date: March 4, 2014


The Bing OCR Control is deprecated as of March 12, 2014

public async void CaptureFrame();
<Button onClick="MyOcrControl.CaptureFrame();" .../>

The action of the CaptureFrame method takes place in five phases.

  1. Takes a picture and stops the camera.

  2. Raises the FrameCaptured event. The image data is stored in the FrameCapturedEventArgs object associated with the event.

  3. Renders the captured image in place of the video preview.

  4. Sends the image to the Bing OCR Service and awaits a response.

  5. Raises the Completed Event when the response arrives. The returned text and image data is stored in the OcrCompletedEventArgs object associated with the event.

The OcrControl.StartPreviewAsync() Method calls CaptureFrame() internally when a user clicks or taps the video preview area. Therefore, it is not necessary to explicitly call this method unless you change the default control UI.


The following example creates a Capture button and a Resume button. The buttons disable themselves when clicked to prevent users from trying to run multiple instances of asynchronous methods.

<Button x:Name="btnCapture" Content="Capture" Click="btnCapture_Click" .../>
<Button x:Name="btnResume" Content="Resume" Click="btnResume_Click" .../>
 private async void btnCapture_Click(object sender, RoutedEventArgs e)
    btnCapture.IsEnabled = false;
    await OCR.CaptureFrame();
    btnCapture.IsEnabled = true;

private async void btnResume_Click(object sender, RoutedEventArgs e)
    btnResume.IsEnabled = false;
    await OCR.StartPreviewAsync();
    btnResume.IsEnabled = true;


Minimum Supported Client

Windows 8.1

Required Extensions

Bing OCR