Compiling Tesseract

204 views
Skip to first unread message

peke...@gmail.com

unread,
Feb 25, 2016, 10:35:33 AM2/25/16
to tesseract-ocr
Hello everyone,

I was trying to install and compiling Tesseract first in Visual Studio 2013 Express for Windows and then because I was not successful with it I tried to install it in Xcode for Os X. I googled so many different websites for finding any help but none of them was very helpful because they are all from 2 years ago.

For Windows I downloaded Tesseract here (https://github.com/tesseract-ocr/tesseract) and also the Package for the german language. Now I do not know how to set up the PATH and including the files in Visual Studio.

For Os X I installed Tesseract with MacPort but I get an error because it does not find the header for Tesseract. But I do not know what I have been doing wrong.

Please help me , I am getting desperate. I am trying to install it for several days!

Thanks a lot!

ShreeDevi Kumar

unread,
Feb 25, 2016, 10:52:05 AM2/25/16
to tesser...@googlegroups.com

See https://github.com/charlesw/tesseract

He has used visual studio 2015

- sent from my phone. excuse the brevity.

--
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.
To post to this group, send email to tesser...@googlegroups.com.
Visit this group at https://groups.google.com/group/tesseract-ocr.
To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/fd88ee1c-d9fe-4c4b-a65e-f4a137f770b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tom Morris

unread,
Feb 25, 2016, 3:51:32 PM2/25/16
to tesseract-ocr
On Thursday, February 25, 2016 at 10:35:33 AM UTC-5, peke...@gmail.com wrote:

I was trying to install and compiling Tesseract first in Visual Studio 2013 Express for Windows and then because I was not successful with it I tried to install it in Xcode for Os X. I googled so many different websites for finding any help but none of them was very helpful because they are all from 2 years ago.
... 
 
For Os X I installed Tesseract with MacPort but I get an error because it does not find the header for Tesseract. But I do not know what I have been doing wrong.
 
I think the default build assumes that you're using Homebrew, not MacPorts.  To compile on OS X with MacPorts, add /opt/local/lib like this:

    ./configure --with-extra-libraries=/opt/local/lib

So your complete quick start would be:

  git clone g...@github.com:tesseract-ocr/tesseract.git
  cd tesseract
  ./autogen.sh
  ./configure --with-extra-libraries=/opt/local/lib
  make
  sudo make install

Tom

peke...@gmail.com

unread,
Feb 29, 2016, 6:34:58 AM2/29/16
to tesseract-ocr
Thank you! Well it works now, but if run a test I get a error (LNK 2019) for every tesseract command I wrote. The sample code I use is:
#include <tesseract/baseapi.h>
#include <leptonica/allheaders.h>

int main()
{
    char *outText;

    tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI();
    // Initialize tesseract-ocr with English, without specifying tessdata path
    if (api->Init(NULL, "eng")) {
        fprintf(stderr, "Could not initialize tesseract.\n");
        exit(1);
    }

    // Open input image with leptonica library
    Pix *image = pixRead("Text2(ENG).JPG");
    api->SetImage(image);
    // Get OCR result
    outText = api->GetUTF8Text();
    printf("OCR output:\n%s", outText);

    // Destroy used object and release memory
    api->End();
    delete[] outText;
    pixDestroy(&image);

    return 0;
}

Is something with that wrong?
I am really sorry for the questions!!

peke...@gmail.com

unread,
Feb 29, 2016, 6:47:04 AM2/29/16
to tesseract-ocr

Thank you! It works now in the terminal. But in Xcode I just get errors when I build it. But now I do not get an error because of the header :)
Reply all
Reply to author
Forward
0 new messages