integralFilter() vs. conv2() speed
2 views (last 30 days)
Show older comments
Hi, I'm using the integralFilter() matlab function in an algorithm for image processing. I choose to use this function because we read that is more fast than a commonly convolution and it has the same speed for different filter size. I try to do a little test to see the speed difference between the two function conv2() and integralFilter() but the result doesn't respect what we aspect. The convolution was compute in approximately 0.3 sec and the integlarFilter in approximately 3 sec, but is not all! I try the same test with more biggest image size and/or more biggest filter size and the result shows that the conv2() doesn't change his speed significatly, instead the integralFilter() speed grown very much. Example: for a 4980x2124 image size, the convolution takes approximately 0.7 sec and the integralFilter takes something like 90 seconds! I open this question because the algorithm have to work more fast that is possible, and i need to completly understand what's the more convenient function to use. Maybe I'll be wrong something in the use of the integralFilter() function. This is the code I use for the test:
% conv2()
I=imread('moon.tif');
gx9b=[0 0 0 0 0 0 0 0 0;
0 0 0 0 0 0 0 0 0;
1 1 1 -2 -2 -2 1 1 1;
1 1 1 -2 -2 -2 1 1 1;
1 1 1 -2 -2 -2 1 1 1;
1 1 1 -2 -2 -2 1 1 1;
1 1 1 -2 -2 -2 1 1 1;
0 0 0 0 0 0 0 0 0;
0 0 0 0 0 0 0 0 0;];
tic
yb=conv2(I,gx9b);
toc
% IntegralFunction()
i=integralImage(I);
gx9=integralKernel([1 1 9 2; 1 3 3 5; 4 3 3 5; 7 3 3 5; 1 8 9 2], [0, 1, -2, 1, 0]);
tic
y=integralFilter(i,gx9);
toc
I hope that you can resolve me this doubt. Thanks in advance for your reply.
Sincerly, Fabio Bigi
2 Comments
Accepted Answer
Image Analyst
on 14 Dec 2013
I never heard of integralFilter. It's not in the Image Processing Toolbox. Did you get it off the File Exchange?
You can try imfilter(). I heard the developer say that its speed and efficiency have been vastly improved (a few years ago) and that it could be faster than conv2(), though you can certainly test that yourself.
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!