Hi all,

(I'm fairly new to Tesseract/Tessbase *and* C++, so sorry in advance
if any of this is unclear.)

There is an OpenFrameworks addon for Tesseract and I'm trying to add
HOCR functionality to it. But, whenever I call the GetHOCRText()
method, the program crashes (the error message is cryptic, but from my
research, supposedly it's a SIGABRT, or maybe EXC_BAD_ACCESS?) If I
call GetUTF8Text() it works fine... Here is the code in question:

==============
string ofxTesseract::findHOCRText(ofImage& img, ofRectangle& roi) {
        ofPixels& pixels = img.getPixelsRef();
        int bytesPerPixel = pixels.getBytesPerPixel();

    tess.SetImage(
        pixels.getPixels(),
        img.getWidth(),
        img.getHeight(),
        bytesPerPixel,
        pixels.getWidth() * bytesPerPixel
    );

    tess.SetRectangle(
        roi.x, roi.y,
        roi.width, roi.height
    );

    //returns 0
    tess.Recognize(NULL);

    //return tess.GetUTF8Text(); // works fine
    return tess.GetHOCRText(0); //crash & burn

}
==============
https://github.com/jessefulton/ofxTesseract/blob/master/src/ofxTesseract.cpp
("tess" is the tesseract::TessBaseAPI)


Any help greatly appreciated!

-- 
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

Reply via email to