Fast FFT convolution in 2D
Afficher commentaires plus anciens
Hello,
Is there a way to do fast 2D convolution according to: FFT Convolution performance ? In 2D it is not any faster, than standard MAtlab`s convolution. The same is reported of MathWorkd central files repository
pd = fspecial('Gaussian', 61, 10);
noise = poissrnd(0.2, [260 260]);
tic
zz1 = imfilter(noise, pd);
toc
tic
zz2 = conv2fft(noise, pd);
toc
% Compare the relative accuracy (the results are nearly identical)
zz2 = zz2(31:end-30, 31:end-30);
aa = max(abs(zz1-zz2)./abs(zz1));
disp(max(aa))
figure( 'units', 'normalized', 'outerposition', [0 0 1 1], 'name', 'Conv FFT 2D', 'numbertitle', 'off' );
subplot 141, imshow(zz1, []); title('Convolution');
subplot 142, imshow(zz2, []); title('FFT');
subplot 143, imshow(zz1-zz2, []); title('Convolution - FFT'); impixelinfo
subplot 144, surf(zz1-zz2); title('Convolution - FFT'); rotate3d on; colormap parula
Results:
Elapsed time is 0.048178 seconds
Elapsed time is 0.021171 seconds
1.0758e-15.
In 1D FFT version is ~300x faster.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Fourier Analysis and Filtering dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!