ImageEn, unit ievision

TIEVisionLibrary.createOCR

TIEVisionLibrary.createOCR


Declaration

function createOCR(language: PAnsiChar = nil; engine: TIEVisionOCREngine = ievOCRDefault): TIEVisionOCR; overload; safecall;
function createOCR(path: PAnsiChar; language: PAnsiChar; engine: TIEVisionOCREngine = ievOCRDefault): TIEVisionOCR; overload; safecall;
function createOCR(path: PAnsiChar; languages: TIEVisionVectorString; engine: TIEVisionOCREngine = ievOCRDefault): TIEVisionOCR; overload; safecall;


Description

Creates an OCR object for the specified language.
Many languages are available as separate files.

Parameter Description
language Language code of OCR recognition (e.g. 'eng', 'fra').
path Folder containing language data files.
engine OCR engine to use.
languages A list of languages.


Demos

  Demos\IEVision\OCR\OCR.dpr
  Demos\IEVision\OCRwithLayout\OCRwithLayout.dpr


Example

OCR := IEVisionLib.createOCR(IEOCRLanguageList[OCR_English_language].Code);

OR

sLanguage := 'fra'; // French
if FileExists( IncludeTrailingPathDelimiter( ExtractFilePath( Application.ExeName )) + sLanguage + '.traineddata' ) = False then
  raise Exception.create( 'Language file not found' );
OCR := IEVisionLib.createOCR( sLanguage );

OR for multiple languages:

var langs: TIEVisionVectorString;
langs := IEVisionLib.createVectorString();
langs.push_back( IEOCRLanguageList[ OCR_English_language ].Code ); // load English
langs.push_back( IEOCRLanguageList[ OCR_Italian_language ].Code ); // load Italian
m_OCR := IEVisionLib.createOCR( '', langs );