% EE 392J
% Project

% Function that gives the real motion vectors

function MVF = realMVF(offsetx,offsety,positions,sizeImager);
% offsetx,offsety = offset of the patch in the camera
% positions = position shifts of the camera
[N dum] = size(positions);
MVF = zeros(sizeImager(1),sizeImager(2),N-2,2);
pos = [0 0];
for t = 1:N-1 % The MVF will be N-1 sized 
    mvf =positions(t+1,:)-positions(t,:);
    pos = pos+mvf;
    for i=offsetx+pos(1):sizeImager(1)-offsetx+pos(1)
        for j = offsety+pos(2):sizeImager(2)-offsety+pos(2)
            MVF(i,j,t,:) = mvf;
        end
    end
end
return
