Configuration and invocation time of the "Tesseract" Tesseract API in VS 2013:2016-05-31 20:35:19 Read:127 comments:0 Favorites:0 [Point I collection +]
Label:
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
- 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";
:
- 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;. Init (null, "eng" , tesseract ::oem_default); //initialize, set language pack
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".
The configuration of the Tesseract API in VS 2013 and the invocation