I'm a newbie with Tesseract, but I know that api.GetUTF8Text() calls Recognize for you. Try removing the call to Recognize to see what happens.
Cheers, Leo. On Thu, Apr 14, 2011 at 7:58 AM, zl2k <[email protected]> wrote: > hi, all > > I have composed a Pix image and here are the 4 lines of code to > recognize the input image (I am using tesseract 3.00) > > tesseract::TessBaseAPI api; > // construct pix_image > api.SetImage(pix_image); > api.SetRectangle(0, 0, pixGetWidth(pix_image), > pixGetHeight(pix_image)); > api.Recognize(NULL); > std::string result = api.GetUTF8Text(); > > The code compiles fine but got the following runtime error: > Please call SetImage before attempting recognition.Please call > SetImage before attempting recognition.terminate called after throwing > an instance of 'std::logic_error' > what(): basic_string::_S_construct NULL not valid > Aborted > > Could you give me some hint on how to fix the problem? Thanks for > help. > > zl2k > > -- > You received this message because you are subscribed to the Google Groups > "tesseract-ocr" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > 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 post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/tesseract-ocr?hl=en.

