OcrEngine
OcrEngine
OcrEngine
OcrEngine
Class
Definition
Provides optical character recognition (OCR) functionality.
public : sealed class OcrEngine : IOcrEnginepublic sealed class OcrEngine : IOcrEnginePublic NotInheritable Class OcrEngine Implements IOcrEngine// You can use this class in JavaScript.
- Attributes
| 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 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>// You can use this property in JavaScript.
- Value
- IVectorView<Language> IReadOnlyList<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.
MaxImageDimension MaxImageDimension MaxImageDimension MaxImageDimension
Gets the maximum image pixel dimensions supported by the OCR engine.
public : static unsigned int MaxImageDimension { get; }public static uint MaxImageDimension { get; }Public Static ReadOnly Property MaxImageDimension As uint// You can use this property in JavaScript.
- Value
- unsigned int uint uint uint
The maximum image pixel dimensions supported by the OCR engine.
RecognizerLanguage 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// You can use this property in JavaScript.
Methods
IsLanguageSupported(Language) 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// You can use this method in JavaScript.
TRUE, if the specified language can be resolved to any of the available OCR languages; otherwise, FALSE.
RecognizeAsync(SoftwareBitmap) 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 )// You can use this method in JavaScript.
Represents an uncompressed bitmap.
The result of the OCR that was initiated by the OcrEngine object.
TryCreateFromLanguage(Language) 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// You can use this method in JavaScript.
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.
TryCreateFromUserProfileLanguages() 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// You can use this method in JavaScript.