Initialising TessBaseAPI - tvn-cosine/tesseract.net GitHub Wiki
How to create an instance of the TessBaseAPI
-
Example 1
string dataPath= "./tessdata/";
string language = "eng";
OcrEngineMode oem = OcrEngineMode.DEFAULT;
PageSegmentationMode psm = PageSegmentationMode.AUTO_OSD;
TessBaseAPI tessBaseAPI = new TessBaseAPI();
// Initialize tesseract-ocr
if (!tessBaseAPI.Init(dataPath, language, oem))
{
throw new Exception("Could not initialize tesseract.");
}
// Set the Page Segmentation mode
tessBaseAPI.SetPageSegMode(psm);
-
Example 2
string dataPath = "./tessdata/";
string language = "eng";
OcrEngineMode oem = OcrEngineMode.DEFAULT;
PageSegmentationMode psm = PageSegmentationMode.AUTO_OSD;
TessBaseAPI tessBaseAPI = new TessBaseAPI(dataPath, language, oem, psm);