function loadImage()
h=gcf;

title='Select Image';
[file, path] = uigetfile( ...
    {'*.jpg;*.bmp','ImageFiles (*.jpg *.bmp)'; ...
        '*.*',  'All Files (*.*)'}, title);
if isequal(file,0)|isequal(path,0)
    disp('File not found')
    I = [];
else
    I = double((imread([path,file])))/255;
    if (size(I,3)==3)
       if ((max(max(abs(I(:,:,1)-I(:,:,2))))<0.05)&(max(max(abs(I(:,:,2)-I(:,:,3))))<0.05)&(max(max(abs(I(:,:,1)-I(:,:,3))))<0.05))
          I=rgb2gray(I);
       end
    end
    
    [n,m,c]=size(I);
    d=min(floor(log2(n-1)),floor(log2(m-1)))-2;
    nn=floor((n-1)/2^d)*2^d+1;
    mm=floor((m-1)/2^d)*2^d+1;
    dn=n-nn; dm=m-mm;
    I=I(1:nn,dm+1:end,:);
end

ind=findstr(file,'.');
matFile=[file(1:ind(end)),'mat'];
L1File=[file(1:ind(end)-1),'_L1.bmp'];
L2File=[file(1:ind(end)-1),'_L2.bmp'];


ds=struct('oim',I,'im',I,'xf',[],'yf',[],'xb',[],'yb',[],'asxf',[],'asyf',[],'asxb',[],'asyb',[],'sxf',[],'syf',[],'sxb',[],'syb',[],'imgPath',path,'imgFile',file,'matFile',matFile,'L1File',L1File,'L2File',L2File,'rad',3);

set(h,'UserData',ds);
subplot(1,3,3)
imshow(zeros(size(I)));
subplot(1,3,2)
imshow(I)
subplot(1,3,1)
imshow(I)


