简体   繁体   中英

How to compile openCV to be guaranteed single threaded?

I'm using openCV in a multithreaded software and I'm starting as many threads as CPUs are available. Further I'm using some openCV functions and there my problem starts. It seems to me that openCV internally starts own threads.

$ ps huH p 30266 | wc -l
1650

1650 Threads??? What are the cmake flags to stop openCVs multithreading support?

As mainactual mentioned, you can set the number of threads at runtime using cv::setNumThreads(int nthreads) . Refer here for more information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM