ImageEn, unit ievision

TIEVisionOCR


Declaration

TIEVisionOCR = interface(TIEVisionBase)


Description

This interface allows you to perform basic OCR (Optical Character Recognition) in English and 100+ other languages.
It is possible to recognize a specific image area or the whole image.
For recognition it means:
- Get the ANSI or Unicode text from a raster image
- Estimate the document orientation (text angle)
- Get each recognized character position (bounding box)
- Get text regions (to reproduce text layout)



To change the language of OCR, specify the path of the language file when calling IEVisionLib.createOCR. You can download language files from:
www.imageen.com/download/

Note: Only one single instance of this object can exist in your application.


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

sLanguage := 'fra'; // French
if FileExists( IncludeTrailingPathDelimiter( ExtractFilePath( Application.ExeName )) + sLanguage + '.traineddata' ) = False then
  raise Exception.create( 'Language file not found' );
OCR := IEVisionLib.createOCR( sLanguage );
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();


Methods and Properties

Public Method  clearAdaptiveInfo
Public Method  getBoxes
Public Method  getOrientation
Public Method  getRegions
Public Method  getTextAngle
Public Method  getWordBoxes
Public Method  isWordValid
Public Method  recognize
Public Method  setSegmentationMode
      

See Also

Public Method  createOCR
Class  TIEVisionLanguages
Class  TIEVisionOCRWordBox
Global Method  IEVisionLanguageCodeToName
Global Method  IEVisionLanguageNameToCode
Global Method  IEVisionGetLanguagesInFolder