title: Issue with lowpass image filter
body: <p>I need to apply a simple low-pass filter on an image, however this needs to be done in the frequency domain. However the final result is a very noisy image, suggesting that my process is incorrect somewhere.</p>
  
  <p>My track of thought has been</p>
  
  <p>1) Center the image (Testpatt) and apply a 2D FFT</p>
  
  <pre><code>tpa1 = size(Testpatt, 1); tpa2 = size(Testpatt, 2);
  dTestpatt = double(Testpatt);
  
  
  for i = 1:tpa1
      for j = 1:tpa2
  
          dTestpatt(i,j) = (dTestpatt(i,j))*(-1)^(i + j);
      end
  end
  
  fftdTestpatt = fft2(dTestpatt);
  </code></pre>
  
  <p>2) Generate the low-pass filter and multiply it with the Fourier transformed image (Note: the low pass filter needs to be a circle of 1's within the radius Do)</p>
  
  <pre><code>lowpfilter = zeros(tpa1, tpa2);
  Do = 120;
  
  for i = 1:tpa1
      for j = 1:tpa2
  
  
         if sqrt((i - tpa1/2)^2 + (j - tpa2/2)^2) &lt;= Do
             lowpfilter(i,j) = 1;
         end
  
     end
  end
  
  
  filteredmultip = lowpfilter*fftdTestpatt;
  </code></pre>
  
  <p>3) Take the real components of the inverse 2D FFT and revert the centering. </p>
  
  <pre><code>filteredimagecent = real(ifft2(filteredmultip));
  
  
  for i = 1:tpa1
      for j = 1:tpa2
  
          filteredimage(i,j) = (filteredimagecent(i,j))*(-1)^(i + j);
      end
  end
  </code></pre>
  
  <p>Any help or comments would be greatly appreciated.</p>