Share via


OcrEngine Class

Definition

Provides optical character recognition (OCR) functionality.

public ref class OcrEngine sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class OcrEngine final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class OcrEngine
Public NotInheritable Class OcrEngine
Inheritance
Object Platform::Object IInspectable OcrEngine
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

To use the OCR capabilities of the OcrEngine class in your app, call the RecognizeAsync method. When you call the RecognizeAsync method of the OcrEngine class, the method returns an OcrResult object, which contains the recognized text and its size and position. The result is split into lines, and the lines are split into words.

  • The OcrResult contains a collection of OcrLine objects, which you access through the Lines property of the OcrResult.
  • Each OcrLine object contains a collection of OcrWord objects, which you access through the Words property of each OcrLine.
  • Each OcrWord object specifies the text, size, and position information of the word in the image.

Properties

AvailableRecognizerLanguages

Returns a collection of all available OCR languages on the device.

MaxImageDimension

Gets the maximum image pixel dimensions supported by the OCR engine.

RecognizerLanguage

Gets the language being used for text recognition.

Methods

IsLanguageSupported(Language)

Returns true if a specified language can be resolved to any of the available OCR languages. See language matching for a further explanation of language resolving.

RecognizeAsync(SoftwareBitmap)

Scans the specified image for text in the language specified by the RecognizerLanguage property.

TryCreateFromLanguage(Language)

Creates a new instance of the OcrEngine class.

TryCreateFromUserProfileLanguages()

Creates a new instance of the OcrEngine class.

Applies to