The configuration of the "Tesseract" Tesseract API in vs 2013 and the invocation

Source: Internet
Author: User

To use the Tesseract library in VS, you must use a DLL that has been compiled with the corresponding VS version and Lib. For example, in VS 2013, you must use the Tesseract library that was compiled in VS 2013.
Here I give a tesseract library that passes the VS 2013 compilation,

Http://pan.baidu.com/s/1o7JqXmU
After extracting content such as,

With the Tesseract library, we configured the environment and included libraries in VS 2013.

Introducing Header Files

In the Solution Manager window –> Right-click "Photo" Project –> "Properties (R)" –> "Configuration Properties" –> "C/C + +" –> "General" –> "additional Include directories": All active solution platforms in the photo project Add the following in all active solution configurations:

C:\tesseract-ocr\include
C:\tesseract-ocr\include\leptonica
C:\tesseract-ocr\include\tesseract

As shown in the following:

Introducing Library Files
    1. Add Property sheet
      First copy the "C:\tesseract-ocr\include" directory to the directory where the local project "Photo" is located. That is, "Photo\photo" under the directory;
      Then make the following settings:
      In the Solution Manager area, switch to the Property Manager window;
      Right-click "Photo" Project –> "Add an existing property sheet (E) ..." –> in the "photo\photo\include" directory to find "Tesseract_versionnumbers.props" –> "open";
      :
    2. Configuration Library files
      In the Solution Manager window –> Right-click the photo Project –> Properties (R) –> Configuration Properties –> Connector –> General –> Additional Library directory: All of the active solution platforms in the "Photo" project, all " In the active solution configuration, add the following:

C:\tesseract-ocr\Lib

To add a pre-defined:
In the Solution Manager window –> Right-click "Photo" Project –> "Properties (R)" –> "Configuration Properties" –> "C/C + +" –> "preprocessor" –> "preprocessor definition" –> by "Active solution Configuration" type "add" The "predefined" content in the following list:

WIN32
_windows
Ndebug
Use_std_namespace

Such as:

Add additional libraries
In the Solution Manager window –> Right-click the photo Project –> Properties (R) –> Configuration Properties –> Connector –> input –> Additional Dependencies –> Press the active solution configuration type add to the list in the following listing. "Additional Library" content:

Ws2_32.lib
User32.lib
Jpeg.lib
Liblept168.lib
Libpng.lib
Libtesseract302.lib
Libtiff.lib
Zlib128-static-mtdll.lib
Zlibstat.lib

Such as:

At this point, the Tesseract API has been configured in the VS2013 project and can then be tested.

The following are some of the main libraries and required code:

#include<leptonica\allheaders.h>  #include<tesseract\baseapi.h>  tesseract::TessBaseAPI api;api.Init(NULL"eng",  tesseract::OEM_DEFAULT);  //初始化,设置语言包

Note that it is important to put the language pack into the Tessdata directory under the root directory of the program execution, I use the Release solution configuration, so put it under "Photo/release/tessdata" instead of "photo/photo/release/ Tessdata "under.
It is also necessary to put this libtesseract302.dll in the root directory of the execution program, "Photo/release".

Tesseract tesseract API configuration and invocation in VS 2013

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.