Class TesseractOcrEngine
OCR engine using Tesseract (https://github.com/tesseract-ocr/tesseract).
public class TesseractOcrEngine : IOcrEngine
- Inheritance
-
TesseractOcrEngine
- Implements
Methods
Bundled(string)
Gets a TesseractOcrEngine instance configured to use the Tesseract executable from the NAPS2.Tesseract.Binaries nuget package using language data .traineddata files in the specified folder.
public static TesseractOcrEngine Bundled(string languageDataPath)
Parameters
languageDataPath
string
Returns
BundledWithModes(string)
Gets a TesseractOcrEngine instance configured to use the Tesseract executable from the NAPS2.Tesseract.Binaries nuget package using language data .traineddata files in the specified folder. The folder is expected to have subfolders named "best" and "fast" with the actual .trainneddata files that will be used based on the OcrMode.
public static TesseractOcrEngine BundledWithModes(string languageDataBasePath)
Parameters
languageDataBasePath
string
Returns
Custom(string, string?)
Gets a TesseractOcrEngine instance configured to use the specified Tesseract executable, optionally looking for .traineddata files in the specified folder.
public static TesseractOcrEngine Custom(string tesseractExePath, string? languageDataPath = null)
Parameters
Returns
CustomWithModes(string, string)
Gets a TesseractOcrEngine instance configured to use the specified Tesseract executable using language data .traineddata files in the specified folder. The folder is expected to have subfolders named "best" and "fast" with the actual .trainneddata files that will be used based on the OcrMode.
public static TesseractOcrEngine CustomWithModes(string tesseractExePath, string languageDataBasePath)
Parameters
Returns
ProcessImage(ScanningContext, string, OcrParams, CancellationToken)
public Task<OcrResult?> ProcessImage(ScanningContext scanningContext, string imagePath, OcrParams ocrParams, CancellationToken cancelToken)
Parameters
scanningContext
ScanningContextimagePath
stringocrParams
OcrParamscancelToken
CancellationToken
Returns
- Task<OcrResult>
System()
Gets a TesseractOcrEngine instance configured to use the Tesseract executable on the system PATH with the system-installed language data.
public static TesseractOcrEngine System()
Returns
Events
OcrError
public event EventHandler<OcrErrorEventArgs>? OcrError
Event Type
- EventHandler<OcrErrorEventArgs>?
OcrTimeout
public event EventHandler? OcrTimeout
Event Type
- EventHandler?