Interface IOCRService
Provides text recognition (OCR) capabilities. Create sessions with CreateSessionAsync(IReadOnlyDictionary<string, object>, CancellationToken) to perform recognition with a fixed set of options.
Inherited Members
Namespace: Zaya.OCR.Services
Assembly: Zaya.OCR.dll
Syntax
public interface IOCRService : IDisposable
Properties
| Edit this page View SourceDescription
Gets the UI description for this engine (localized).
Declaration
LocalizedString Description { get; }
Property Value
| Type | Description |
|---|---|
| LocalizedString |
DisplayName
Gets the UI display name for this engine (localized).
Declaration
LocalizedString DisplayName { get; }
Property Value
| Type | Description |
|---|---|
| LocalizedString |
EngineId
Gets a unique identifier for this OCR engine (e.g., "oneocr", "tesseract"). Used for profile serialization and engine lookup.
Declaration
string EngineId { get; }
Property Value
| Type | Description |
|---|---|
| string |
IsAvailable
Gets whether this OCR engine is available on the current system.
Declaration
bool IsAvailable { get; }
Property Value
| Type | Description |
|---|---|
| bool |
PreferredPixelFormat
Gets the pixel format preferred by this OCR engine. The caller (e.g., a screenshot module) can use this to deliver pixels in the optimal format without extra conversion.
Declaration
PixelFormat PreferredPixelFormat { get; }
Property Value
| Type | Description |
|---|---|
| PixelFormat |
Settings
Gets the list of engine-specific settings that can be configured via UI.
Declaration
IReadOnlyList<SettingDescriptor> Settings { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<SettingDescriptor> |
Methods
| Edit this page View SourceCreateSessionAsync(IReadOnlyDictionary<string, object>, CancellationToken)
Creates a new OCR session with the specified engine settings.
Declaration
Task<IOCRSession> CreateSessionAsync(IReadOnlyDictionary<string, object> engineSettings, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyDictionary<string, object> | engineSettings | Engine-specific settings dictionary, or |
| CancellationToken | cancellationToken | Token to cancel session creation. |
Returns
| Type | Description |
|---|---|
| Task<IOCRSession> | An active OCR session ready to recognize text. |
CreateSessionAsync(CancellationToken)
Creates a new OCR session with the default engine settings.
Declaration
Task<IOCRSession> CreateSessionAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | Token to cancel session creation. |
Returns
| Type | Description |
|---|---|
| Task<IOCRSession> | An active OCR session ready to recognize text. |