Optimize cvtcolor, convert from yuv2 to bgr

asked 2018-10-08 03:09:32 -0600

Shir gravatar image

After profiling my x3399 board(arm cores) using DS-5 streamline I realized that the most heavy function in my system is cvGetHuMoments, after deep search in my code I realized that this function is related to cvtcolor conversion from yuv2 to bgr? is it possible? I can`t find in my profiler where exactly I use the cvGetHuMoments function but when I disable the cvtcolor conversion it disappeared in the profiler. If the problem is with cvtcolor, how would you recommend to optimize it? I thought about using opencl or neon optimization(arm compute library) but could not really understand how to implement it in my code, I would be happy to get a tutorial on how to implement it(replace the cvtcolor in my code). Thanks

edit retag flag offensive close merge delete

Comments

those functions are unrelated.

which opencv version is it ?

there is a test which uses cvGetHuMoments but that's the only place where that is used (you also should NOT use any functions from the deprecated C-api in your code)

none of your assumptions make any sense here (that's the good news !)

berak gravatar imageberak ( 2018-10-08 03:13:59 -0600 )edit
1

opencv version = 3.3

Is there a list of functions which use cvGetHuMoments?

Shir gravatar imageShir ( 2018-10-08 03:30:08 -0600 )edit

you can grep the opencv src code, or the github repo (which i did above)

also look at the src for it -- 7floats going in, another 7 going out, a few mults. entirely unlikely, that this should use any significant resources. (it's also only used for shape analysis)

cvtColor, however is another kind of beast. it has to manipulate whole, multi-channel images. it would make a lot of sense, if that showed up high in your usage profile. (and no, you probably can't write any program without it)

berak gravatar imageberak ( 2018-10-08 03:36:34 -0600 )edit

OK, so how I can optimize the cvtcolor function?

Shir gravatar imageShir ( 2018-10-08 04:03:23 -0600 )edit

have a look at the src and try to find out, which optimizations are used, and available on your board. parallel_for_ is used a lot, so make sure, you have some Parallel Framework like tbb,omp,phtreads enabled

sorry, i can't help any further here.

berak gravatar imageberak ( 2018-10-08 04:07:42 -0600 )edit