integralFilter() vs. conv2() speed

16 ビュー (過去 30 日間)
Fabio
Fabio 2013 年 12 月 14 日
編集済み: Fabio 2013 年 12 月 14 日
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 件のコメント
Matt J
Matt J 2013 年 12 月 14 日
編集済み: Matt J 2013 年 12 月 14 日
I don't have the Computer Vision Toolbox, so I can't repeat your test. Does it help if you re-express your integral kernel with overlapping, and hence fewer, boxes:
gx9=integralKernel([1 1 9 9; 1 3 9 5; 4 3 3 5], [0, 1, -3])
Fabio
Fabio 2013 年 12 月 14 日
Yes I had already try it, but doesn't improve performance.

サインインしてコメントする。

採用された回答

Image Analyst
Image Analyst 2013 年 12 月 14 日
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.
  1 件のコメント
Fabio
Fabio 2013 年 12 月 14 日
It is in Computer Vision System toolbox http://www.mathworks.it/it/help/vision/ref/integralfilter.html I will try imfilter() as soon as possible.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by