Ocr​Engine Ocr​Engine Ocr​Engine Class

Definition

Provides optical character recognition (OCR) functionality.

public : sealed class OcrEngine : IOcrEnginepublic sealed class OcrEngine : IOcrEnginePublic NotInheritable Class OcrEngine Implements IOcrEngine
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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 AvailableRecognizerLanguages AvailableRecognizerLanguages

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

public : static IVectorView<Language> AvailableRecognizerLanguages { get; }public static IReadOnlyList<Language> AvailableRecognizerLanguages { get; }Public Static ReadOnly Property AvailableRecognizerLanguages As IReadOnlyList<Language>
Value
IVectorView<Language> IReadOnlyList<Language> IReadOnlyList<Language>

A collection of all available OCR languages on the device.

Note

A language pack must be installed on the device to be used. A user can install new OCR language packs through the Settings app.

Attributes

MaxImageDimension MaxImageDimension MaxImageDimension

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

public : static unsigned short MaxImageDimension { get; }public static uint MaxImageDimension { get; }Public Static ReadOnly Property MaxImageDimension As uint
Value
unsigned short uint uint

The maximum image pixel dimensions supported by the OCR engine.

Attributes

RecognizerLanguage RecognizerLanguage RecognizerLanguage

Gets the language being used for text recognition.

public : Language RecognizerLanguage { get; }public Language RecognizerLanguage { get; }Public ReadOnly Property RecognizerLanguage As Language
Value
Language Language Language

The language being used for text recognition.

Attributes

Methods

IsLanguageSupported(Language) IsLanguageSupported(Language) 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.

public : static PlatForm::Boolean IsLanguageSupported(Language language)public static bool IsLanguageSupported(Language language)Public Static Function IsLanguageSupported(language As Language) As bool
Parameters
language
Language Language Language

The language being used for text recognition.

Returns
PlatForm::Boolean bool bool

TRUE, if the specified language can be resolved to any of the available OCR languages; otherwise, FALSE.

Attributes

RecognizeAsync(SoftwareBitmap) RecognizeAsync(SoftwareBitmap) RecognizeAsync(SoftwareBitmap)

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

public : IAsyncOperation<OcrResult> RecognizeAsync(SoftwareBitmap bitmap)public IAsyncOperation<OcrResult> RecognizeAsync(SoftwareBitmap bitmap)Public Function RecognizeAsync(bitmap As SoftwareBitmap) As IAsyncOperation( Of OcrResult )
Parameters
bitmap
SoftwareBitmap SoftwareBitmap SoftwareBitmap

Represents an uncompressed bitmap.

Returns

The result of the OCR that was initiated by the OcrEngine object.

Attributes

TryCreateFromLanguage(Language) TryCreateFromLanguage(Language) TryCreateFromLanguage(Language)

Creates a new instance of the OcrEngine class.

public : static OcrEngine TryCreateFromLanguage(Language language)public static OcrEngine TryCreateFromLanguage(Language language)Public Static Function TryCreateFromLanguage(language As Language) As OcrEngine
Parameters
language
Language Language Language

The language being used for text recognition.

Returns

If the specified language can be resolved to any of the OCR languages available on the device, returns new instance of OcrEngine class, otherwise returns null. See language matching for a further explanation of language resolving.

Attributes

TryCreateFromUserProfileLanguages() TryCreateFromUserProfileLanguages() TryCreateFromUserProfileLanguages()

Creates a new instance of the OcrEngine class.

public : static OcrEngine TryCreateFromUserProfileLanguages()public static OcrEngine TryCreateFromUserProfileLanguages()Public Static Function TryCreateFromUserProfileLanguages() As OcrEngine
Returns

If any language from GlobalizationPreferences.Languages can be resolved to any of the available OCR languages returns new instance of OcrEngine class, otherwise returns null.

Attributes