Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

OCR.GetText

Returns recognized text.

Component Version macOS Windows Linux Server iOS SDK
OCR 2.9 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "OCR.GetText" )

Parameters

none

Result

Returns the text.

Description

Returns recognized text.
Calls Recognize if needed internally.

We intent to remove tesseract 3.x library from the plugin in summer 2022, so please move to loading the newer version using OCR.Load function.

Examples

Query text:

$text = MBS( "OCR.GetText" )

Custom function to read image and return text:

/*
MBS-OCR ( language; Image)

Requires tessdata resources [MIT ©]
language: deu ('deu.traineddata), fra, eng, etc.
Image: Container Fieldname ('MyTable::MyField') in Quotes
path: FM/Extensions - put 'tessdata' Folder into FM Extensions Folder

Benjamin Fehr, EfficientBizz GmbH
http://www.efficientbizz.com
*/

Let (
[

// init OCR
    $path = MBS ("Path.FileMakerPathToNativePath"; Get(FileMakerPath)& "Extensions/") ;
    initialize = MBS( "OCR.Initialize"; $path; language) ; $Error = initialize ;
    SegMode = MBS( "OCR.SetPageSegMode"; "Auto");

// Process Image
    $img = MBS("GMImage.NewFromContainer"; Image);
    set = MBS("OCR.SetImage"; $img) ;
    $result = MBS("OCR.GetText") ;


// Cleanup
    $clean = MBS( "OCR.Cleanup") ;
    $destroy = MBS( "GMImage.Release"; $img)


]
; "" )

See also

Release notes

Example Databases

This function is free to use.

Created 18th August 2014, last changed 13th March 2022


OCR.GetPageSegMode - OCR.GetTextAsJSON