Ask Your Question
1

Program uses too much CPU.. What can be done?

asked 2015-05-28 17:36:13 -0600

215 gravatar image

What can be done to reduce the CPU time of this OpenCV code. It keeps Crashing my program making it hard to test on.

http://pastebin.com/Tyh26xqA

I know there is a lot of code...

So here is an overview of the code: I start by using haarCascade to detect Face. when one has been detected the user press y to conform it has been found.

In the next state will GoodFeatures be found at which Lukas kanade is being used to track them with forward backward error estimation. By using Simple Stats I move the Mask at which the Lukas Kanade optical flow is applied.

For some reason it use a lot of CPU, And I can't seem to find any way of optimizing it... I think i have done the best I can.. I cannot see what else i can do..

Could OpenCV be used with CUDA?

Any help is appreciated.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-06-19 10:14:26 -0600

binbin gravatar image

updated 2015-06-19 10:16:14 -0600

Yes. first you need to compile OpenCV with CUDA enabled. Then you need to write your code with APIs under 'gpu' module, instead of using the generic ones. For my case OpenCV + CUDA reduced my CPU usage a lot for haarCascade face detection, so it should be worthy to try.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2015-05-28 17:36:13 -0600

Seen: 1,200 times

Last updated: Jun 19 '15