Here is an example. I separately interpolate the x and y components of the vector fields. I am not sure if there is a benefit in somehow jointly interpolating the components at this time.
%% load data
clear;close all
load mandrill
[M,N]=size(X);
%% Define Grid
[Theta,Phi]=meshgrid(linspace(0,1,floor(M/50)),linspace(0,1,floor(N/50)));
%% Define Arbitrary Vector Feild
b(:,:,1)= .7*(.5-Theta);
b(1,:,1)=0;b(end,:,1)=0;b(:,1,1)=0;b(:,end,1)=0;
b(:,:,2)= .7*(.5-Phi);
b(1,:,2)=0;b(end,:,2)=0;b(:,1,2)=0;b(:,end,2)=0;
%% Plot Vector Feild
close all
image(linspace(0,1,M),linspace(0,1,N),X);hold on;
quiver(Theta,Phi,b(:,:,1),b(:,:,2),0,'white','linewidth',1)
%% interpolate at each gridpoint
[theta,phi]=meshgrid(linspace(0,1,M),linspace(0,1,N));
bnew(:,:,1)=interp2(Theta,Phi,b(:,:,1),theta,phi);
bnew(:,:,2)=interp2(Theta,Phi,b(:,:,2),theta,phi);
%% Apply Deformation to the grid
close all
figure(1)
mesh(theta,phi,X'); view([0,0,1]);title('Before')
figure(2)
mesh(theta+bnew(:,:,1),phi+bnew(:,:,2),X');title('After')
view([0,0,1])
|