|
I want to create a program in C++ with Tesseract, but when I try to compile the source code some errors appear.
I don't know well how to link the libs to the source code, but I did do like this: |
#include <baseapi.h> #include <allheaders.h> #include <iostream> #include <opencv/cv.h> #include <opencv/highgui.h> using namespace std; int main() { tesseract::TessBaseAPI tess; tess.Init(NULL, "eng", tesseract::OEM_DEFAULT); cv::Mat image = cv::imread("/home/souto3/Pictures/num.tif"); tess.SetImage((uchar*)image.data, image.size().width, image.size().height, image.channels(), image.step1()); tess.Recognize(0); const char* out = tess.GetUTF8Text(); cout << out; return 0; }
------------------------------ END CODE -------------------
-------------------- ERROR --------------------------------/tmp/ccAUGhHc.o: In function `main': main.cpp:(.text+0x1b): undefined reference to `tesseract::TessBaseAPI::TessBaseAPI()' main.cpp:(.text+0x75): undefined reference to `cv::imread(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)' main.cpp:(.text+0x101): undefined reference to `tesseract::TessBaseAPI::SetImage(unsigned char const*, int, int, int, int)' main.cpp:(.text+0x115): undefined reference to `tesseract::TessBaseAPI::Recognize(ETEXT_DESC*)' main.cpp:(.text+0x124): undefined reference to `tesseract::TessBaseAPI::GetUTF8Text()' main.cpp:(.text+0x15c): undefined reference to `tesseract::TessBaseAPI::~TessBaseAPI()' main.cpp:(.text+0x1c8): undefined reference to `tesseract::TessBaseAPI::~TessBaseAPI()' /tmp/ccAUGhHc.o: In function `tesseract::TessBaseAPI::Init(char const*, char const*, tesseract::OcrEngineMode)': main.cpp:(.text._ZN9tesseract11TessBaseAPI4InitEPKcS2_NS_13OcrEngineModeE[tesseract::TessBaseAPI::Init(char const*, char const*, tesseract::OcrEngineMode)]+0x4f): undefined reference to `tesseract::TessBaseAPI::Init(char const*, char const*, tesseract::OcrEngineMode, char**, int, GenericVector<STRING> const*, GenericVector<STRING> const*, bool)' /tmp/ccAUGhHc.o: In function `cv::Mat::release()': main.cpp:(.text._ZN2cv3Mat7releaseEv[cv::Mat::release()]+0x4b): undefined reference to `cv::fastFree(void*)'
------------------------ END ERROR ----------------------------------------------------------------------
--
You received this message because you are subscribed to the Google
Groups "tesseract-ocr" group.
To post to this group, send email to tesser...@googlegroups.com
To unsubscribe from this group, send email to
tesseract-oc...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/tesseract-ocr?hl=en
Hi,
I have a linking to tesseract problem in Qt C++ project on Windows,
1. tesseract-ocr 3.01 do not (officially) support/create dll. As far as I remember, only static linking was successful. Use 3.02 (in svn).What libs exactly should I create for linking and compiling on MinGW build system ?
I built previously using visual studio compiler and got above libs but failed to link using mingw build
system.
Hi,
I checked out full r724 from repository,
Hi,trying to build using MinGW + MSYS the 3.02checked from svn r724. Is that right ?
then runned in msys terminal on the root directory of the checkout./autogen.shand got:"Running aclocal./autogen.sh : line50 : aclocal : command not foundSomething went wrong, bailing out!"Why such ?
Thanks.
--
You received this message because you are subscribed to the Google
Groups "tesseract-ocr" group.
To post to this group, send email to tesser...@googlegroups.com
To unsubscribe from this group, send email to
tesseract-oc...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/tesseract-ocr?hl=en
Thanks for your reply. I was hoping that I'd be able to find a regular browser page with the download ZIP file option. Could you post all the required login info, please? Ugh, I never have good luck using svn clients. I just tried to download 'Setup-Subversion-1.7.9.msi' for Windows32. It promptly reported that it couldn't be loaded. Can you recommend an svn client that actually works on Windows or as a plug-in for Eclipse or as a simple binary that works on the Windows command line?I've got the "undefined reference to `tesseract::TessBaseAPI::TessBaseAPI()'" blues too. I'm trying to build a tesseract 3.02.02 c++ project in Eclipse and at the Win command line and that's as far as I get. BTW, tessbaseapi.h is nowhere to be found in any of my 3.02.02 install (or 3.01 or tesseract-android-tools for that matter).. But baseapi.h is present. My include and library dirs are from "win32-lib-include-dirs" from a ZIP download. Compiles, but linking fails with that error.
>Have you looked at my "Using the latest Tesseract-OCR sources" page [1] that explains how to use TortoiseSVN to get the latest sources?
I tried installing Tortroise too. Couldn't install it either.
I have only downloaded and unzipped the latest 3.02 ZIP contributions from Google's Tesseract-OCR download site into individual directories (preserving their directory structure of course). Isn't that sufficient? So svn is the base directory of the repository at Github that you were referring to.
>"Programming with libtesseract" [2] discusses how to use libtesseract with VS2008 but some of the information applies to any compiler. baseapi.h and leptonica's allheaders.h are the headers you need to include.
They're already included. Guess that's why it compiles (but won't link). So tessbaseapi.h was from an earlier version?
I don't have Visual Studio and I don't want to buy it. Thus, all the vcproj files are evidently useless to me.
I've been trying to use MinGW GCC as my current toolchain and CDT Internal Builder as my current builder within Eclipse. In a batch file, it should be either:set ti=<installdir>\tesseract-3.02.02-win32-lib-include-dirs\include\tesseractset li=<installdir>\leptonica-1.68-win32-lib-include-dirs\include\leptonicag++ -c -I%li% -I%ti% src\MinAreaRects.cppor...set ti=<installdir>\tesseract-ocr-3.02.02-src\Tesseract-OCR\include\tesseractset li=<installdir>\leptonica-1.68-win32-lib-include-dirs\include\leptonica
g++ -c -I%li% -I%ti%\ccmain -I%ti%\ccutil -I%ti%\api -I%ti%\ccstruct src\MinAreaRects.cppi.e. - I assume that when compiling with the 'tesseract-3.02.02-win32-lib-include-dirs' then only one path entry is needed: '\include\tesseract'.
And when compiling with 'tesseract-ocr-3.02.02-src'', then the relevant subdirectories (like \Tesseract-OCR\api) DO need to be added to the compiler's include path.Since I don't have VS2008, I can't attempt to use the Microsoft Visual C++ toolchain (having no 'cl.exe').
>You might want to look at.[3] which contains a very short tesseract sample app (essentially the same as tesseract.exe).
I assume that references to using 'libtesseract' (at least in terms of ver 3.02) really means linking 'libtesseract302.dll' or 'libtesseract302d.dll' from the downloaded lib directory.
Is the d version for debugging?
So, the library entry for the linker should be 'tesseract302' or 'tesseract302d' (dropping the lib prefix and the .dll suffix). Just wanna be sure I've dotted all my i's. In my code snippet below, the variable declaration works (indicating a good compile). But the instantiation just below it never does (indicating a bad link).TessBaseAPI *tessa;tessa = new TessBaseAPI();Correct me if I'm wrong about any of this. Thanks again.
The following error has occurred during XML parsing:File: I:\Android\Tesseract\tesseract-3.02.02\tesseract-ocr-3.02-API-Example-vs2008\APIExample\baseapitester\baseapitester.vcprojLine: 27Column: 4Error Message:Property sheet file '..\..\include\tesseract_versionnumbers.vsprops' was not found or failed to load.The file'I:\Android\Tesseract\tesseract-3.02.02\tesseract-ocr-3.02-API-Example-vs2008\APIExample\baseapitester\baseapitester.vcproj' has failed to load.tesseract_versionnumbers.vsprops doesn't exist in the APIExample directory or its subdir. However, those exist in my:tesseract-3.02.02-win32-lib-include-dirs\include and tesseract-3.02.02-win32-lib-include-dirs-vs2008\include directories. I copied the latter to the same directory as your sln file. I ran VC again. Same error. I copied it to the baseapitester subdir instead. Same error. The Line referenced in the error message refers to the line in baseapitester.vcproj that reads:} else if (image == NULL) {which seems totally irrelevant to the error.
Actually, I chose MinGW toolchain in Eclipse because OpenCV242\build\x86 had only MinGW and vc9 and vc10 directories to choose from for includes and libs. Not having vc at the time, I thought it would offer the best chance of success. So, the OpenCV part of my program (which I didn't mention earlier) DOES compile and link.I downloaded TortoiseSVN-1.7.11.23600-x64-svn-1.7.8.msi. When I run it, the following dialog pops up:Windows InstallerThis installation package is not supported by this processor type. Contact your product vendor.
I just have ALL the luck, don't I? Still, your suggestion about recent code variations is worth exploring and I'll find some other client to download it with. Eclipse has a facility (or available plug-in) for linking to repositories. Just gotta figure out the nitty gritty. Do I need to register for a username and password at Google as part of repository access or will 'anonymous' do? I just want to build a simple c++ exe, so I fail to see how the latest and greatest is going to help. And point taken about Github/Google. Thank you so much for the time you've spent in trying to help. -Ted
>Have you looked at my "Using the latest Tesseract-OCR sources" page [1] that explains how to use TortoiseSVN to get the latest sources?
I tried installing Tortroise too. Couldn't install it either. I have only downloaded and unzipped the latest 3.02 ZIP contributions from Google's Tesseract-OCR download site into individual directories (preserving their directory structure of course). Isn't that sufficient? So svn is the base directory of the repository at Github that you were referring to.
>"Programming with libtesseract" [2] discusses how to use libtesseract with VS2008 but some of the information applies to any compiler. baseapi.h and leptonica's allheaders.h are the headers you need to include.
They're already included. Guess that's why it compiles (but won't link). So tessbaseapi.h was from an earlier version? I don't have Visual Studio and I don't want to buy it. Thus, all the vcproj files are evidently useless to me. I've been trying to use MinGW GCC as my current toolchain and CDT Internal Builder as my current builder within Eclipse. In a batch file, it should be either:
set ti=<installdir>\tesseract-3.02.02-win32-lib-include-dirs\include\tesseractset li=<installdir>\leptonica-1.68-win32-lib-include-dirs\include\leptonicag++ -c -I%li% -I%ti% src\MinAreaRects.cppor...set ti=<installdir>\tesseract-ocr-3.02.02-src\Tesseract-OCR\include\tesseractset li=<installdir>\leptonica-1.68-win32-lib-include-dirs\include\leptonica
g++ -c -I%li% -I%ti%\ccmain -I%ti%\ccutil -I%ti%\api -I%ti%\ccstruct src\MinAreaRects.cppi.e. - I assume that when compiling with the 'tesseract-3.02.02-win32-lib-include-dirs' then only one path entry is needed: '\include\tesseract'.
And when compiling with 'tesseract-ocr-3.02.02-src'', then the relevant subdirectories (like \Tesseract-OCR\api) DO need to be added to the compiler's include path.Since I don't have VS2008, I can't attempt to use the Microsoft Visual C++ toolchain (having no 'cl.exe').>You might want to look at.[3] which contains a very short tesseract sample app (essentially the same as tesseract.exe).
I assume that references to using 'libtesseract' (at least in terms of ver 3.02) really means linking 'libtesseract302.dll' or 'libtesseract302d.dll' from the downloaded lib directory. Is the d version for debugging? So, the library entry for the linker should be 'tesseract302' or 'tesseract302d' (dropping the lib prefix and the .dll suffix). Just wanna be sure I've dotted all my i's. In my code snippet below, the variable declaration works (indicating a good compile). But the instantiation just below it never does (indicating a bad link).
TessBaseAPI *tessa;tessa = new TessBaseAPI();Correct me if I'm wrong about any of this. Thanks again.
--
--
You received this message because you are subscribed to the Google
Groups "tesseract-ocr" group.
To post to this group, send email to tesser...@googlegroups.com
To unsubscribe from this group, send email to
tesseract-oc...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/tesseract-ocr?hl=en
---
You received this message because you are subscribed to the Google Groups "tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-oc...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
But if anyone knows of another angle/translation/scale image correction approach (or code), I'd love to hear about it. I.e. Image stabilization.
Wer can i find tessbaeapi.h??
--
--
You received this message because you are subscribed to the Google
Groups "tesseract-ocr" group.
To post to this group, send email to tesser...@googlegroups.com
To unsubscribe from this group, send email to
tesseract-oc...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/tesseract-ocr?hl=en
i get an error as follows
ajmal@ajmal-Inspiron-5523:~/Desktop/project$ g++ sample.cpp phototest.tif
/usr/bin/ld:phototest.tif: file format not recognized; treating as linker script
/usr/bin/ld:phototest.tif:1: syntax error
collect2: ld returned 1 exit status
You received this message because you are subscribed to a topic in the Google Groups "tesseract-ocr" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tesseract-ocr/xp4hajq-o2A/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tesseract-oc...@googlegroups.com.