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));
% 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
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