ImageEn, unit ievision

IEVisionGetLanguagesInFolder

IEVisionGetLanguagesInFolder


Declaration


function IEVisionGetLanguagesInFolder(ssDest : TStrings; const sFolder : string; bDisplayName : Boolean = False) : Boolean;


Description


Finds all the language files in a folder and fills ssDest with their display name or language code.

Language files of IEVision will be named with a language code followed by extensions such as traineddata (IEV_OCR_Language_Data_Ext), word-freq, params, size, etc.

Result is false if no language files are found.


Example


procedure TMainForm.FormCreate(Sender: TObject);
begin
  // Fill our Combobox with available languages
  IEVisionGetLanguagesInFolder(cmbLanguage.Items, ExtractFilePath(Application.ExeName), True);

  // Default to English
  cmbLanguage.ItemIndex := cmbLanguage.Items.IndexOf(IEOCRLanguageList[OCR_English_language].DisplayName);
end;

procedure TMainForm.btnRecognizeClick(Sender: TObject);
var
  sLangCode: string;
begin
  // Get selected language code
  sLangCode := IEVisionLanguageNameToCode(cmbLanguage.Text);

  // create OCR object
  m_OCR := IEVisionLib.createOCR(PAnsiChar(ExtractFilePath(Application.ExeName)), PAnsiChar(sLangCode), ievOCRFAST);
  ...
end;


See Also


- TIEOCRLanguages
- LanguageExistsInFolder
- IEVisionLanguageCodeToName
- IEVisionLanguageNameToCode