% The kernel function for NLM filter, which gives high weigth to numbers in
% the middle of the chosen window.
function [kernel] = make_kernel(f)              

kernel=zeros(2*f+1,2*f+1);   
for d=1:f    
  value= 1 /(2*(d)+1)^2 ;    
  for i=-d:d
  for j=-d:d
    kernel(f+1-i,f+1-j)= kernel(f+1-i,f+1-j) + value ;
  end
  end
end
kernel = kernel ./ f;
kernel(f+1,f+1) = kernel(f+1,f+1)*2;
