Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 412
user1587451 Avatar asked Mar 06 '16 15:03

user1587451


1 Answers

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

like image 127
cyrusbehr Avatar answered Oct 07 '22 16:10

cyrusbehr