New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenCV 3.1 MSER not thread-safe #7639
Comments
Almost all OpenCV algorithms are not thread-safe by design (for performance reasons and code complexity). |
So far I have used various OpenCV implementations like BRISK, ORB and also MSER in the branch 2.4 and never had a problem with multithreading. The results also seemed quite reasonable and reproducible. |
In general it is not very hard to add required synchronization primitives. |
Letting each thread individually initialize MSER is what I also thought of already. Though our framework usually creates the appropriate Feature-Detector and -Descriptor objects already beforehand for design reasons. For testing I can move the creation right before detectRegions and see whether the Segfault also appears in that case. |
UPDATE:
|
It is not a bug. |
Dear all, My function is like void text_recon(Mat &frameI) |
It seems the Mser_Impl implementation of OpenCV 3.1.0-dev is not thread-safe for some reason.
When the Mser detection is started with OMP parallelization with 4-8 threads the program is stopped with a Segmentation fault error.
Each OMP thread holds its own instance of image, contours and bboxes, e.g.:
Before I tried the last version of the OpenCV 2.4 branch and the Mser implementation using mserD->detect(...) worked perfectly with multithreading.
As segmentation faults are quite difficult to track down with multithreading I used valgrind.
Attached is the log file with some excerpts of the valgrind output.
It fails to read and write in updateTree, growHistory, checkAndCapture, etc. In all cases CompHistory is involved. In OpenCV 2.4 CompHistory does not exist in that form. I think this problem could only be solved by code analysis, as debugging with multithreading is irreproducible.
log.txt
The text was updated successfully, but these errors were encountered: