Fourier Transform of Gaussian Kernel in Matlab
2 次查看(过去 30 天)
显示 更早的评论
Hi everyone,
I need your help!
I was reading a document on Discrete Fourier Transform and found the following example:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/962100/image.png)
Here's the mentioned gaussian kernel:
g_k = (1/256)*[1 4 6 4 1;...
4 16 24 16 4;...
6 24 36 24 6;...
4 16 24 16 4;...
1 4 6 4 1];
As can be seen, the size of g_k or g(x,y) is 5 x 5 - while the size of G(u,v) is around 380 x 450
Can you please show me the Matlab code that can generate the above G(u,v) image or result?
0 个评论
采纳的回答
Matt J
2022-4-12
编辑:Matt J
2022-4-12
If you download gaussfitn from
then you can do,
g0=[1 4 6 4 1]';
params=gaussfitn((-2:2)',g0,[],{0,[],0},{0,[],0});
[A,mu,sig2]=deal(params{2:4});
sig=1/2/pi/sqrt(sig2);
fun=@(x) exp(-(x/sig).^2/2);
Gu=fun(linspace(-6*sig,+6*sig,450));
Guv=imresize(Gu'*Gu,[380,450]);
imshow(Guv);
0 个评论
更多回答(1 个)
Matt J
2022-4-12
One could also do as below. This gives only an approximately Gaussian spectrum, however,
g_k = (1/256)*[1 4 6 4 1;...
4 16 24 16 4;...
6 24 36 24 6;...
4 16 24 16 4;...
1 4 6 4 1];
Guv=fftshift( abs(fft2(g_k,380,450)) );
imshow(Guv)
7 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!