%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This function returns the salicny maps with different scales
%By LI Jian
%2010-April-11th
%The input image shoule be square matrix
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function  [SMs]=MSSM(image);
[m,n]=size(image);
inImg=im2double(image);
myFFT = fft2(inImg); 
myLogAmplitude = log(abs(myFFT));
myLogAmplitude0=fftshift(myLogAmplitude);
myPhase = angle(myFFT);

SMs=zeros(m,n,7);

for k=1:7
    myLogAmplitude=imfilter(myLogAmplitude0, fspecial('gaussian', 127,(2^(k-1))), 'replicate');
    myLogAmplitude=fftshift(myLogAmplitude);
    saliencyMap = abs(ifft2(exp(((myLogAmplitude + i*myPhase))))).^1; 

     saliencyMap = mat2gray(saliencyMap);
    buff=zeros(128);
    buff(5:124,5:124)=saliencyMap(5:124,5:124);
    SMs(:,:,k)=buff.^2;
end











