Platforms to show: All Mac Windows Linux Cross-Platform

TessEngineMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class OCR MBS OCR Plugin 21.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Function: The class for OCR recognition using tesseract library.
Example:
Dim OCR As new TessEngineMBS // your instance of tesseract

If Not ocr.Initialize("C:\Program Files\Tesseract-OCR\tessdata", "eng") Then
MsgBox "failed to initialize"
Quit
End If

Dim f As FolderItem = SpecialFolder.Desktop.Child("test.jpg")
Dim p As Picture = f.OpenAsPicture
OCR.SetImage(p)

// get the text
Dim OCRText As String = OCR.GetText
Notes:
This replaces the older TesseractMBS class.

The new class is for Tesseract 4.x and 5.x versions.

Feedback, Comments & Corrections

OCR Engine Running Modes

Constant Value Description
kOcrEngineModeDefault 3 Specify this mode when calling init_*(), to indicate that any of the above modes should be automatically inferred from the variables in the language-specific config, command-line configs, or if not specified in any of the above should be set to the default kOcrEngineModeTesseractOnly.
kOcrEngineModeLstmOnly 1 Run just the LSTM line recognizer.
kOcrEngineModeTesseractLstmCombined 2 Run the LSTM recognizer, but allow fallback to Tesseract when things get difficult. deprecated
kOcrEngineModeTesseractOnly 0 Run Tesseract only - fastest; deprecated

Page Layout

Constant Value Description
kPageSegModeAuto 3 Fully automatic page segmentation, but no OSD.
kPageSegModeAutoOnly 2 Automatic page segmentation, but no OSD, or OCR.
kPageSegModeAutoOsd 1 Automatic page segmentation with orientation and script detection. (OSD)
kPageSegModeCircleWord 9 Treat the image as a single word in a circle.
kPageSegModeOsdOnly 0 Orientation and script detection only.
kPageSegModeRawLine 13 Treat the image as a single text line, bypassing hacks that are Tesseract-specific.
kPageSegModeSingleBlock 6 Assume a single uniform block of text. (Default.)
kPageSegModeSingleBlockVertText 5 Assume a single uniform block of vertically aligned text.
kPageSegModeSingleChar 10 Treat the image as a single character.
kPageSegModeSingleColumn 4 Assume a single column of text of variable sizes.
kPageSegModeSingleLine 7 Treat the image as a single text line.
kPageSegModeSingleWord 8 Treat the image as a single word.
kPageSegModeSparseText 11 Find as much text as possible in no particular order.
kPageSegModeSparseTextOsd 12 Sparse text with orientation and script det.

This class has no sub classes.

Some examples using this class:

Blog Entries


The items on this page are in the following plugins: MBS OCR Plugin.


TessChoiceIteratorMBS   -   TesseractChoiceIteratorMBS

The biggest plugin in space...




Links
MBS Xojo PDF Plugins

Start Chat