I think you are asking for samples of the original texture in [u,v] . You can use interp2 .
Say the texture samples are in z , and you need new z2 samples. To interpolate the original texture in [u,v] , use:
z2 = interp2(x,y,z,u,v);
On the other hand, if you want to map the βwarpedβ texture back onto the spaced grid [x2,y2] , use griddata :
[x2,y2] = meshgrid(1:N2,1:M2); z2 = griddata(u,v,z,x2,y2);
Update:
Here is a sample code showing how to do this with real data. Using normalized coordinates makes the process easier.
% get texture data load penny z = P; % define original grid based on image size [m,n] = size(z); [a,b] = meshgrid(linspace(0,1,n), linspace(0,1,m)); % define new, differently sized grid m2 = 256; n2 = 256; [x,y] = meshgrid(linspace(0,1,n2), linspace(0,1,m2)); % define deformed grid u = sqrt(x); v = y.^2; % sample the texture on the deformed grid z2 = interp2(a,b,z,u,v); % plot original and deformed texture figure subplot(2,1,1) surface(a,b,z,'EdgeColor','none') axis ij image off colormap gray title('original') subplot(2,1,2) surface(x,y,z2,'EdgeColor','none') axis ij image off colormap gray title('deformed')
And this is the result:
