Hello everyone,

I'm currently trying to use Tesseract for text recognition in a 
multi-threaded application, but I've run into some issues. My goal is to 
capture screen screenshots in different threads and perform OCR immediately 
upon detecting changes in the screen. However, I've noticed that using 
Tesseract in a multi-threaded environment often leads to exceptions or 
crashes.

Here's a basic outline of my approach: I have a monitoring thread that 
periodically captures screen screenshots, and when changes are detected, a 
new thread is started to perform OCR. However, I frequently encounter 
problems when releasing Tesseract resources, especially when calling the 
End() function.

Here are some solutions I've tried:

   1. 
   
   *Using mutexes or semaphores:* I ensure that only one thread can access 
   the Tesseract instance during OCR. While this reduces the frequency of 
   crashes, it hasn't completely solved the problem.
   2. 
   
   *Controlling the lifecycle of resources:* I've tried releasing Tesseract 
   resources immediately after each use, but this hasn't solved all the issues 
   in practice.
   3. 
   
   *Consulting official documentation and examples:* I've reviewed the 
   official Tesseract documentation and some example code, but I haven't found 
   specific recommendations or best practices for multi-threaded applications.
   
I'm wondering if there are any suggestions or best practices for safely 
using Tesseract in a multi-threaded environment? Perhaps there are specific 
configurations or techniques that can help me avoid these issues.

Thank you!

-- 
You received this message because you are subscribed to the Google Groups 
"tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tesseract-ocr+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tesseract-ocr/a94b26f5-994b-41a4-b0d2-0d3eaf8eb9bdn%40googlegroups.com.

Reply via email to