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

Create 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 (*.TrainedData) files. If a path is not specified the Windows current directory is assumed
engine OCR engine to use
languages A list of languages

Note:
A shortcut method for this is available: OCR
To find text boxes in photographs, you can use detectTexts
To avoid specifying a path for the language file, call SetCurrentDir() with the language path


Demos

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


Examples

OCR := IEVisionLib.createOCR(IEOCRLanguageList[OCR_English_language].Code);
str := OCR.recognize(ImageEnView1.IEBitmap.GetIEVisionImage(), IEVisionRect(0, 0, 0, 0)).c_str();

OR

lang := 'fra'; // French
if FileExists( IncludeTrailingPathDelimiter( ExtractFilePath( Application.ExeName )) + lang + '.traineddata' ) = False then
  raise Exception.create( 'Language file not found' );
OCR := IEVisionLib.createOCR( lang );
str := OCR.recognize(ImageEnView1.IEBitmap.GetIEVisionImage(), IEVisionRect(0, 0, 0, 0)).c_str();

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 );
str := m_OCR.recognize(ImageEnView1.IEBitmap.GetIEVisionImage(), IEVisionRect(0, 0, 0, 0)).c_str();


// Extract text from an image
mOCR := IEVisionLib.createOCR( PAnsiChar( AnsiString( IEOCRLanguageList[OCR_English_Language].Code )) );
mOCR.setSegmentationMode( ievOCRAuto );
Memo1.Text := mOCR.recognize( ImageEnView1.IEBitmap.GetIEVisionImage(), IEVisionRect( ImageEnView1.SelectedRect )).c_str();



Skew Angle Estimation and Correction of Hand
Written, Textual and Large areas of Non-Textual
Document Images: A Novel Approach
D.R.Ramesh Babu
PES Institute of Technology
Bangalore, Karnataka
India
Piyush M Kumat
Research Scholar
PICT, Pune
India
Mahesh D Dhannawat
Research Scholar
PICT, Pune
India
Abstract- Skew angle estimation and correction of a
document page is an important task for document
analysis and optical character recognition (OCR)
applications. Many approaches of skew detection can
process pure textual document images successfully. But
it is a challenging problem to process documents like