ImageEn, unit ievision

TIEVisionOCR


Declaration

TIEVisionOCR = interface(TIEVisionBase)


Description

An interface to perform OCR (Optical Character Recognition) in English and 110 other languages:

Afrikaans, Albanian, Amharic, Ancient Greek, Arabic, Armenian, Assamese, Azerbaijani, Basque, Belarusian, Bengali, Bosnian, Breton, Bulgarian, Burmese, Catalan,
Cebuano, Cherokee, Simplified Chinese, Traditional Chinese, Corsican, Croatian, Czech, Danish, Dhivehi, Dutch, Dzongkha, English, Equations, Esperanto, Estonian,
Faroese, Filipino, Finnish, Frankish, French, Gaelic, Galician, Georgian, German, Greek, Gujarati, Haitian, Hebrew, Hindi, Hungarian, Icelandic, Indonesian, Inuktitut,
Irish, Italian, Japanese, Javanese, Kannada, Kazakh, Khmer, Korean, Kurdish, Kyrgyz, Lao, Latin, Latvian, Lithuanian, Luxembourgish, Macedonian, Malay, Malayalam,
Maltese, Maori, Marathi, MICR, Middle English, Middle French, Mongolian, Nepali, Norwegian, Occitan, Oriya, Pashto, Persian, Polish, Portuguese, Punjabi, Quechua,
Romanian, Russian, Sanskrit, Serbian, Sindhi, Sinhala, Slovakian, Slovenian, Spanish, Sundanese, Swahili, Swedish, Syriac, Tagalog, Tajik, Tamil, Tatar, Telugu, Thai,
Tibetan, Tigrinya, Tongan, Turkish, Ukrainian, Urdu, Uyghur, Uzbek, Vietnamese, Welsh, Western Frisian, Yiddish, Yoruba

Recognition supports:
Reading ANSI or Unicode text from a raster image
Estimating the document orientation (text angle)
Getting each recognized character position (bounding boxes)
Getting 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
A shortcut method for this is available: OCR
To find text boxes in photographs, you can use detectTexts


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();


Methods and Properties

Public Method  clearAdaptiveInfo
Public Method  getBoxes
Public Method  getConfidence
Public Method  getOrientation
Public Method  getRegions
Public Method  getStructure
Public Method  getTextAngle
Public Method  getWordBoxes
Public Method  isWordValid
Public Method  langLoaded
Public Method  recognize
Public Method  setBlackAndWhiteList
Public Method  setSegmentationMode
      

See Also

createOCR
TIEVisionLanguages
TIEVisionOCRWordBox
IEVisionLanguageCodeToName
IEVisionLanguageNameToCode
IEVisionGetLanguagesInFolder