Ask Your Question
0

how to accelerate filter2D with multi-core CPU?

asked 2017-11-28 03:08:38 -0600

fashengchen gravatar image

I'm using filter2d to proceed a convolution with a 13x13 kernel. I found even I enabled Intel IPPICV, there is still only one core works. My cpu is intel E5 v4(54 cores) . Can filter2d with ipp work in a multi thread ways? Currently, my solution is using pthread to divide image into several blocks to accelerate the convolution(each block was proceeded by a thread). In order to make sure no tearing between the block and the block, each block overlaps 6 pixels. This leads to another problem. The problem is filter2D doesn't has any option to perform 'valid convolution' (the convolution reduce the image size), which when I create more threads, the efficiency drops dramatically. Does anyone can tell me a way to enable mutli core filter2D, or to do valid convolution using openCV?

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted
0

answered 2017-11-28 11:54:01 -0600

matman gravatar image

If your convolution is separable you can use external parallelization like in my answer here. When using sepFilter2D you can create kernels in constructor once.

The problem with filter2D is that FFT convolution is used in case of kernel sizes >11 (see here and parallelization like above will not work.

As far as I know IPP isn't multithreaded at all and OpenCVs implementation isn't, too.

edit flag offensive delete link more
0

answered 2017-11-28 04:40:58 -0600

VxW gravatar image

updated 2017-11-28 04:51:07 -0600

Hi,

you can try a convolution with separable filters. However, not all convolution kernels are separable.

Have a look at:

Opencv sepFilter2D

getDerivKernels

IPP

separable kernels

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-11-28 03:08:38 -0600

Seen: 1,016 times

Last updated: Nov 28 '17