Ask Your Question
0

Increasing CPU usage in OpenCV app

asked 2014-06-04 10:47:05 -0600

I wrote a simple OpenCV app in Win7 that opens an RGB image file, multiplies it pixelwise, and then saves it under a new name. I compiled OpenCV with TBB yet cannot seem to get this app to use more than one core nor get it to use more than ~40% of a single core. System idle is around 60% and it seems like I could squeeze some more speed out of OpenCV if I knew how.

Can anyone get me pointed in the right direction?

Thanks.

edit retag flag offensive close merge delete

Comments

In my opinion, a simple task does not require parallel or optimal code. Keep simple tasks simple. On the contrary, TBB is a worthwhile direction for parallelizing existing code since its usage is not too complicated while having good performance and utilizing all the hardware resources effectively. Other paths you can take are C++11 threads and Windows threads, the latters are faster (but more efforts are required) than the formers. By the way, to get a more helpful answer, providing more details about your problem, I mean your code.

tuannhtn gravatar imagetuannhtn ( 2014-06-05 03:19:59 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-06-04 12:09:56 -0600

Witek gravatar image

updated 2014-06-04 17:20:35 -0600

Not many functions (but more and more with new releases) in OpenCV are multithreaded. You can check it by browsing the source for HAVE_TBB. For your simple example, divide your image to as many parts as you have cores and use parallel version of for loop. You can use TBB or OpenMP, the latter being much simpler in my opinion.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-06-04 10:47:05 -0600

Seen: 707 times

Last updated: Jun 04 '14