I wrote a small demo with tesseract APIs to run in parallel via OpenMp; it is basically an example taken from tesseract APIs usage page, with some openmp flavour added on it. The executable takes two arguments: a tif file and an integer for the page to be ocrized.
I'm compiling like this: g++-5 -o tessapi-quality tessapi-quality.cpp -I/usr/local/include/tesseract -L/usr/local/lib -llept -ltesseract -fopenmp -g
The problem I'm facing is that it works most of the time, but one over ten - or more - it throws a seg fault.
I tried and debug with gdb, and it seems it's a pointer freed but never allocated: I can't find such an error in my code.
I wonder if it's something I can't see or it is something related to tesseract multithread safety.
The code is on github.