views:

296

answers:

1

I am building a real-time closed-loop image processing application. I waste at least 3ms using cvSmooth():

cvSmooth(Obj->ImgOrig,Obj->ImgSmooth,CV_GAUSSIAN,Params->GaussSize*2+1);

This ends up being the single slowest operation in my entire code. I want to be able to blur my image to varying amounts depending on user input before thresholding and processing my image further. Is there a faster way of doing this?

There are other options for CvSmooth beyond a gaussian. Is there any reason to believe that they will perform any better?

I'm running OpenCV 1.1 with the Intel Primitives installed.

+1  A: 

I don't think there is too much you can do.

First of all, yes, CV_BLUR instead of CV_GAUSSIAN will definitely run faster. When smoothing with Gaussian, the weighted average is calculated with Gaussian weights, but when using CV_BLUR, the all pixels within the radius are given the same weight. This is a simpler operation and so can be done much faster than the Gaussian blur. The fastest way to do a Gaussian blur is to use convolution, which is much more computationally intensive.

Also maybe try OpenCV 2.0 if it's not too much trouble. It uses SSE and OpenMP, which both enable parallel processing. It's not a sure thing that it will be faster though.

Ray Hidayat