function img = morph(src1,src2,fv1,fv2,alpha)
% alpha <= 0 <= 1.0
% returns an image representing flowvec from src1->src2
% assumes src1 and src2 are the same dimension

img = [];

xmesh = meshgrid([1:size(src1,2)],[1:size(src1,1)]);  
ymesh = meshgrid([1:size(src1,1)],[1:size(src1,2)])'; 

xc1 = xmesh + alpha*fv2(:,:,1);
yc1 = ymesh + alpha*fv2(:,:,2);
xc2 = xmesh + (1.0-alpha)*fv1(:,:,1);
yc2 = ymesh + (1.0-alpha)*fv1(:,:,2);

for i=1:3,
    img(:,:,i) = (1.0-alpha)*interp2(xmesh,ymesh,src1(:,:,i),xc1,yc1) + ...
       (alpha)*interp2(xmesh,ymesh,src2(:,:,i),xc2,yc2);
end;
