I just stumbled upon this question and am trying to know about its effects by practically testing it.
Consider a (nxn) Gaussian kernel. Choose the appropriate variance for the same. Perform linear and circular convolution in the frequency domain with this kernel on an image. Can you say anything about the results?
I tried to implement the above in Matlab , with the following code.
clc;
close all;
clear all;
I = imread('my_face.jpg');
Irez = imresize(I,[512 512]); %resize image
figure(1);
imshow(Irez);
Irez = rgb2gray(Irez);
M = 2*size(I,1)+1;
N = 2*size(I,2)+1;
Ifreq = fft2(I,M,N);
gaus = fspecial('gaussian',5,0.7);
Igaus = conv2(gaus,abs(Ifreq));
Iface = real(ifft2(Igaus));
Iout = Iface(1:size(I,1),1:size(I,2));
figure(2)
imshow(Iout);
My questions are :
Am I on the right track? Am I doing what the problem is expecting me to? Or should I take or consider the fft of the gaussian kernel or have a similar Gaussian kernel in frequency domain? Please do tell me if you guys found the right way to achieve this.
Linear convolution's equivalent is multiplication. What is the equivalent of circular convolution?
Moreover, the above code is giving me the following error :
Undefined function or method 'conv2' for input arguments of type 'double' and attributes 'full 3d real'
It is obvious that both have to be double for input of conv2. Can you please help me to practically implement the problem?