我正在制作一个大文本识别程序。我正在尝试在多线程模式下使用 Tesseract(最多 50 个线程)。 有时当我调试我的程序时,我会在这一行出现错误(Segmentation Fault):
/// 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_);
}
在文件...\tesseract-ocr\dict\dawg.h
我像这样在每个线程中创建 tesseract 的每个实例:
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;
}
我正在使用 Tesseract 3 dll
最佳答案
尝试检查变量“edges_”、“edge_ref”、“next_node_mask”,它可能同时在其他线程中被修改,修改会导致段错误。如果你得到段错误,你可以看到其他线程的调用堆栈,以及这个变量在其他线程中的使用情况。
关于c++ - Tesseract OCR QT 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20480076/