Re: Tesseract API example

583 views
Skip to first unread message

TP

unread,
May 21, 2013, 9:05:10 AM5/21/13
to tesseract-ocr
On Tue, May 21, 2013 at 2:59 AM, Arthur Ozga <aoz...@gmail.com> wrote:
I am looking to use Tesseract as a backend for a web-based OCR app using visual c++ and the .Net framework, written using Visual Studio 2010/2012. Unfortunately, I don't really understand how to integrate Tesseract in the system using the api calls in baseapi.h
Could anyone tell me what #include's i should be using and how to copy the .dll's as well as add them to my project? Alternately, could you point to me to a good resource on how to approach this issue?

Since you're apparently new to all this I would recommend first getting everything to work with Visual Studio 2008. Otherwise you'll have to figure out any problems with incorrect building using VS2010 or VS2012 at the same time.  As I mentioned in another recent post, you can still get Visual Studio 2008 Express free from here [1].

You can then just use the tesseract DLL directly via the C api (capi.h) and the standard pinvoke technique (see "Platform Invoke Tutorial" [2] for details).

Alternatively, see my "c# and liblept" page [3], it should be relatively simple to use the same concepts with tesseract. The basic idea is to use the neat C++/CLI syntax extensions [3b][3c] which makes it trivial to interface C/C++ with any .NET language.

Also read my somewhat out of date "Programming with libtesseract" [4]. In fact, to make your life easier --- since you're probably going to eventually have to recompile tesseract and maybe leptonica, especially if you plan on doing any debugging --- read the entire "Visual Studio 2008 Developer Notes for Tesseract-OCR" [5] of which that page is only a part.

Once you're ready see my "Visual Studio 2010 Notes" [6] for a short explanation on what was needed to use leptonica's VS2008 solution with VS2010. The same thing will work with tesseract.

[1] http://download.microsoft.com/download/E/8/E/E8EEB394-7F42-4963-A2D8-29559B738298/VS2008ExpressWithSP1ENUX1504728.iso

[2] http://msdn.microsoft.com/en-us/library/aa288468(v=VS.71).aspx

[3] http://tpgit.github.io/UnOfficialLeptDocs/vs2008/csharp-and-liblept.html

[3b] http://msdn.microsoft.com/en-us/library/xey702bw(v=vs.90).aspx

[3c] http://en.wikipedia.org/wiki/C++/CLI

[4] http://tesseract-ocr.googlecode.com/svn/trunk/vs2008/doc/programming.html#programming-with-libtesseract

[5] http://tesseract-ocr.googlecode.com/svn/trunk/vs2008/doc/index.html

[6] http://tpgit.github.io/UnOfficialLeptDocs/vs2008/vs2010-notes.html#visual-studio-2010-notes

Reply all
Reply to author
Forward
0 new messages