Convolve 2 dimensional signals using the FFT.
This method is faster but less accurate than conv2 for large a and b. It also uses more memory. A small complex component will be introduced even if both a and b are real.
See also: conv2, fftconv, fft, ifft.
The following code
## Draw a cross
z = zeros (101, 101);
z(50, :) = 1;
z(:, 50) = 1;
subplot (1, 3, 1)
imshow (z);
title ("Original thin cross")
## Draw a sinc blob
b = getheight (strel ("ball", 10, 1));
subplot (1, 3, 2)
imshow (b);
title ("Sync blob")
## Convolve the cross with the blob
fc = real (fftconv2 (z, b, "same"));
subplot (1, 3, 3)
imshow (fc, [min(fc(:)) max(fc(:))])
title ("Convolution in the frequency domain")
Produces the following figure
| Figure 1 |
|---|
![]() |
Package: image