InitializeEngine Fails with exception
Last Post 24 Feb 2014 07:11 PM by Devscope Helpdesk. 1 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Devscope HelpdeskUser is Offline
New Member
New Member
Posts:16


--
24 Feb 2014 06:43 PM

    Hello,

    I've successfully compiled using the x64 dll using the instructions in another thread in this fórum but now i have a diferent problem.

    I've derived my own project by using the base demo for Windows provided in the SDK.

    I've selected the Portuguese language and Segmentation Mode of Automatic page segmentation.

     

    The project performs and validates successfully the license, but

    when performing "PrepareTesseractEngine" by calling the function

    _ocrEngine.InitializeEngine

     line - InitializeEngine _ ocrEngine. InitializeEngine (initParams does) - and it stopped and does not return a message.

    Any help would be apreciated.

    Devscope HelpdeskUser is Offline
    New Member
    New Member
    Posts:16


    --
    24 Feb 2014 07:11 PM

    Hello,

    The problems is related to the loading and path of the language dictionaries.

    The first thing to make sure is to get version 1.5.1 that fixes a problem in x64 Ocr Initialization.

    Then check a few things in your project, as in the image below:

    • In the visual studio build settings check the location where your build version is being deployed.
    • In your case the platform target should be set to x64
    • Now Pay atention to the Output path location

    The demo version is assuming that you will have a Tessdata folder with your dictionaries in the same path where your program is executing and so, accordingly with the settings above you should have the following under \bin\debug:

    • A tessdata folder
    • Language dictionary files under the previous tessdata folder.
     
    string dictionariesPath = AppDomain.CurrentDomain.BaseDirectory;  // THIS WILL USE THE Build settings Output Path:
    bool initok;             
    try             
    {                 
    TesseractOcrInitParams initParams = new TesseractOcrInitParams();
    initParams.TessdataRootPath = dictionariesPath;   // THIS SETS THE PARENT ROOT of the Tessdata Folder              
    initParams.LanguageDataPrefixCodes.Add(language);                 
    initParams.DisableDictionaries = false;                 
    initok = _ocrEngine.InitializeEngine(initParams);             
    }             
    catch (Exception ex)
    {     
    // THE MOST PROBABLE EXCEPTION THROWN HERE IS FILE (DICTIONARY) NOT FOUND
    throw;             
    }
     

    So check that the path of initParams.TessdataRootPath and make sure that it points to a location that contains the tessdata folder and if you are using the demo file, make sure that the tessdata folder is under the output path.

    Hope this helps.

    The DevScope team

     

     

    You are not authorized to post a reply.