clear all
close all
[X,map]=imread('Mars','gif');
% image(X);
%colormap(map), axis off
image(X); colormap(map);
size(X)
% circles
 i1 = zeros(2,2);
 sprintf 'click center of  image'
 i1(1,:)=ginput(1);
 sprintf 'click point on circumference of image'
 i1(2,:)=ginput(1);
C(1,:) = [ ceil(i1(1,1)) ceil(i1(1,2))];
RR = ceil(sqrt((i1(2,1)-i1(1,1))^2+((i1(2,2))-i1(1,2))^2))
%---------------------------------------------
% convert to square centered at Ci
   n11 = ceil(C(1,1)-RR)
   n12 = ceil(C(1,1)+RR)
   m11 = ceil(C(1,2)-RR)
   m12 = ceil(C(1,2)+RR)
   mm = m12 - m11+1 
   nn = n12 - n11+1 
   % Now magnify contents gradually
   %B = zeros(mm,nn,3);
   size(X)
   [m11,m12,n11,n12]
   B = X(m11:m12, n11:n12);
   size(B)
%Z = zeros(m,n,3);
figure
for i=1:4*mm
   for j=1:4*nn
       yc = i/4;
       xc = j/4;
%       Z(i,j,1) = CubicInterp2Dc(yc,xc,1,mm,1,nn,B);
      Z(i,j) = LinInterp2Dc(yc,xc,1,mm,1,nn,B);
   end
end
colormap('default'), axis off
image(Z);