title: What is optical transfer function in Image restoration?
body: <p>I am studying Inverse Filtering, I was trying to code it, I sought out some references from the net. Everyone has considered optical transfer function which is no where to be seen in Gonzalez Book I am referring to. </p>
  
  <pre><code>% Inverse_Filter_Demo-
  
  
  clc
  clear all
  close all
  
  
  original_image=imread('cameraman.jpg'); %loading the original (un-blurred) image
  original_image=double(original_image);
  
  %The  blur function (PSF- Point Spread Function) that will be added  to the original image
  PSF=fspecial('motion',20,45);
  
  %Adding blur to the original image
  degraded_image = imfilter(original_image,PSF,'circular','conv');
  
  OTF= psf2otf(PSF,[size(degraded_image,1) size(degraded_image,2)]);%Getting OTF from PSF
  Inverse_Filter=conj(OTF)./((abs(OTF)).^2); %The inverse filter
  
  %Preforming Fourier Transform to the degraded image
  FT_degraded_image=fftn(degraded_image);
  
  %Preforming the restoration itself
  restored_image=abs(ifftn(FT_degraded_image.*Inverse_Filter));
  
  %Presenting the restoration results:
  
  figure;
  set(gca,'Fontsize',14);
  colormap(gray);
  imagesc(original_image,[0 255]);
  truesize;    
  title('Original image');
  
  
  figure;
  set(gca,'Fontsize',14);
  colormap(gray);
  imagesc(degraded_image,[0 255]);
  truesize;    
  title('Degraded image');
  
  
   figure;
  set(gca,'Fontsize',14);
  colormap(gray);
  imagesc(restored_image,[0 255]);
  truesize;    
  title('Restoration of the degraded image (using Inverse Filter)');
  </code></pre>