Using Tesseract OCR in VC++

随声附和 提交于 2019-12-21 20:58:35

问题


In my project I have to read the numbers from the image(.jpg or .tiff). After googling a lot, I came to know about the open OCR i.e., Tesseract OCR. Am begginer for Tesseract OCR, I read all the documentation of tesseract & how to use it in Visual studio. Bascically am facing some problem in using tesseract... I followed the steps like this:

1) Downloaded & Installed tesseract-ocr-setup-3.02.02.exe from http://code.google.com/p/tesseract-ocr/downloads/detail?name=tesseract-ocr-setup-3.02.02.exe

2)Open up Microsoft Visual Studio 2008 and go to Tools -> Options Project solutions -> VC++ Directories -> Show directories for include files

Add:
C:\Program Files\Tesseract-OCR\include
C:\Program Files\Tesseract-OCR\include\tesseract
C:\Program Files\Tesseract-OCR\include\leptonica

3) Next click show directories for -> Library Files
Add: C:\Program Files\Tesseract-OCR\lib

4) Configure linker options for Tesseract
Right click your project in solution explorer and click properties
Configuration Properties -> Linker->Input ->Additional Dependencies
Add this in there:
libtesseract302.lib
libtesseract302d.lib
liblept168.lib
liblept168d.lib

5) Copy liblept168.dll, liblept168d.dll, libtesseract302.dll and libtesseract302.dll from C:\Program Files\Tesseract-OCR\ into your project folder

6) main.cpp source file looks like this :

#include<baseapi.h>
#include <allheaders.h>
#include <iostream>
using namespace std;

int main(void){

    tesseract::TessBaseAPI api;
    api.Init("", "eng", tesseract::OEM_DEFAULT);
    api.SetPageSegMode(static_cast<tesseract::PageSegMode>(7));
    api.SetOutputName("out");

    cout<<"File name:";
    char image[256];
    cin>>image;
    PIX   *pixs = pixRead(image);

    STRING text_out;
    api.ProcessPages(image, NULL, 0, &text_out);

    cout<<text_out.string();

}

The problem is am unable to compile this code.. Am getting linker error i.e., LINK : fatal error LNK1181: cannot open input file 'libtesseract302.lib'.
As I downloaded Tesseract OCR. In Tesseract-OCR\lib am not finding libtesseract302.dll and libtesseract302.dll files.. Am able to see only liblept168.dll, liblept168d.dll files.
I tried to searching for libtesseract302.lib & libtesseract302.dll but am not getting anything.
Am totally struck up at this point.
If anyone has used Tesseract OCR, please suggest me on this.

Thank you all..

来源:https://stackoverflow.com/questions/14066074/using-tesseract-ocr-in-vc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!