multithreading - OpenCV CascadeClassifier C++ Interface in Multiple Threads -
I would like to run an OpenCV C ++ interface in multiple threads using the CascadeClassifier object.
The way my program works, my main thread loads "some_file.xml" in a CascadeClassifier object, three or more threads are generated and they pass the cascade object. The program crashes afterwards. I have done many tests and have concluded that the CascadeClassifier object thread is not secure-while doing the "catechmeltiscale" function.
I do not want to save the same file every time to read the hard drive off. The new thread is created, how can it be avoided?
Higher cascade is stored in new format if you are working with LABP cascade You can avoid reading cascade from the file system for each new thread:
In Load Cascade Memory:
cv :: FileStorage fs (path_to_cascade_file, cv :: FileStorage :: Read); If (! Fs.isOpened ()) Handleearer (); For next-stage FS objects, create a new CascadeClassifier object for each new thread:
cv :: CascadeClassifier cc; If (! Cc.read (fs.getFirstTopLevelNode ()) handler 2 ();
Comments
Post a Comment