Ask Your Question
0

Querying and controlling OpenCV on used accelaration method

asked 2016-02-01 06:29:35 -0500

Leonid Volnitsky gravatar image

updated 2016-02-01 06:40:50 -0500

I was doing testing of OpenCV background subtraction algorithms. After recompiling OpenCV (from github, tagged as 3.1) and adding CUDA and EIGEN, I've noticed that MOG2 became about 30% faster but KNN became 4 times slower. I also have OPENCL, IPP, TBB and SSE/AVX enabled. I usually use one universal include file (opencv2/opencv.hpp)

Is there a way to find out what acceleration method OpenCV have used in its functions?

Or is there a way to control what acceleration method will be used?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

answered 2016-02-01 09:43:15 -0500

pklab gravatar image

You could follow the code step by step into OpenCV with a debugger if you build t with debug info (set BUILD_WITH_DEBUG_INFO in cmake) and configure your IDE to use them (see this how to with Visual Studio)

I would suggest to build and run performance tests from OpenCV. Enabling BUILD_PERF_TEST in cmake you will have a set of ready to use performance tests from OpenCV. Google C++ Testing Framework is used. See How To Use Perf Tests in QA in OpenCV

For example, to test MOG2 performance you could use opencv_perf_video. There is a perf_test for each module. Each test gives additional information about current parallel framework, ...

You could write your own test case using your data and same library/code (see How to Write Perf Tests) . On this way you will have an independent and repeatable performance test that might be shared with other user here.

In addiction you can test many functions at one time, this helps to understand where you gain and where you loose.

edit flag offensive delete link more

Comments

Will BUILD_WITH_DEBUG_INFO make opencv application slower?

Leonid Volnitsky gravatar imageLeonid Volnitsky ( 2016-02-01 15:13:14 -0500 )edit

Of course application is slower when runs in debug mode ! but, after you have understood "what acceleration method OpenCV have used in its functions" you can always use Release mode for performance... don't you agree?

pklab gravatar imagepklab ( 2016-02-02 10:08:17 -0500 )edit

Thanks. I wish it was easier to switch or use two versions side by side.

Leonid Volnitsky gravatar imageLeonid Volnitsky ( 2016-02-02 11:07:56 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-02-01 06:29:35 -0500

Seen: 144 times

Last updated: Feb 01 '16