Hina Kagiyama
Hina Kagiyama

Reputation: 95

Tesseract OCR QT errors

I'm making a large-text recognizing program. I'm trying to use Tesseract in multithreaded mode (up to 50 threads). Sometimes when I am debugging my program I get an error (Segmentation Fault) on this line:

/// Returns true if the edge spot in this location is occupied.
inline bool edge_occupied(EDGE_REF edge_ref) const
{
    return (edges_[edge_ref] != next_node_mask_);
}

In the file ...\tesseract-ocr\dict\dawg.h

I am creating each instance of tesseract in every thread like so:

tesseract::TessBaseAPI *text_ocr = new tesseract::TessBaseAPI();

if (text_ocr->Init(NULL,"eng",tesseract::OEM_DEFAULT))
{
    qDebug() << "fail to init tessract in the thread" << _id;
    return;
}

I'm using Tesseract 3 dll

Upvotes: 1

Views: 792

Answers (2)

Hina Kagiyama
Hina Kagiyama

Reputation: 95

I managed to get rid of that error, after i started to use the new qt 5.2.0 with msvc2012 so i used pre-built tesseract 3.02 (msvc) binaries for win32. Actually, still if you create too many same tesseract instances, application will just crash.

Upvotes: 0

asaenko
asaenko

Reputation: 235

Try to check variables "edges_","edge_ref","next_node_mask", it's may be modified in other threads in same time and modification will caus segfault. If you get segmentation fault, you can see callstack of other threads, and usage of this variable in other threads.

Upvotes: 1

Related Questions