# Explaination of Fourier Blur

**URL:** <https://psychtoolbox.discourse.group/t/explaination-of-fourier-blur/1469>\
**Category:** Uncategorized\
**Created:** [February 27, 2004, 3:03pm UTC](https://psychtoolbox.discourse.group/t/explaination-of-fourier-blur/1469 "2004-02-27T15:03:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [February 27, 2004, 3:03pm UTC](https://psychtoolbox.discourse.group/t/explaination-of-fourier-blur/1469/1 "2004-02-27T15:03:14Z")

</div>

I'm running a program that systematically blurs stimuli and I   
obtained the code a while ago. I need an explaination of what   
exactly is going on. Essentially, the image comes on the screen,   
with a designated blur fac (a value that assignes a standardized   
blur). then the img=blur function is called. After that, i'm not sure   
what is happening, and I need an explaination in order to make   
sense of results.  
Thanks!  
heres part of the code  
  
blurFac(i)=check(response,i,blurFac,trialorder,origBlur);  
blurImg=blur(origImg,blurFac(i));   
  

> \>\>\>\>\>\>

function img=blur(blurImg,w)  
 % convert image to Fourier domain. Shift origin from topLeft to   
centre.  
 FI= fftshift(fft2(blurImg));  
  
 % create mask  
 [yDim xDim] = size(blurImg);  
 [x y] = meshgrid(-xDim/2+1:xDim/2,-yDim/2+1:yDim/2);  
 G = exp(-(x.^2 + y.^2)/(w^2));  
  
 % multiply the MASK and image in Fourier domain  
 R=FI.\*G;  
 IR=ifft2(fftshift(R)); % shift origin back to topLeft before inverse   
FFT  
 img=IR;  
end
