How to compile openCV to be guaranteed single threaded?

Viewed 1777

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?

1 Answers

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

Related