[X,Y,Z] = peaks(100) ;
pcolor(X,Y,Z)
shading interp
h = imrect() ;
pos = wait(h);
% Display the part extracted
x0 = pos(1) ; y0 = pos(1) ;
L = pos(3) ; B = pos(4) ;
x1 = x0+L ;
y1 = y0+L ;
N = 500 ;
x = linspace(x0,x1,N) ;
y = linspace(y0,y1,N) ;
[Xi,Yi] = meshgrid(x,y) ;
Zi = interp2(X,Y,Z,Xi,Yi) ;
pcolor(Xi,Yi,Zi) ;
shading interp
