Skip to content

Instantly share code, notes, and snippets.

@RDharmaTeja
Created December 9, 2014 05:51
Show Gist options
  • Save RDharmaTeja/b1ff47310b02fc7d69cc to your computer and use it in GitHub Desktop.
Save RDharmaTeja/b1ff47310b02fc7d69cc to your computer and use it in GitHub Desktop.
%return field matrix
function [X,Y] = velocityField(img1,img2,boxWidth,boxHeight,overLap)
%img1,img2: intensitity matrices
%boxWidth,boxHeight: interrogaiton box size
%overlap values can go from 0 to 1, but not 1
imgWidth=size(img1,1);
imgHeight=size(img1,2);
x=1;
y=1;
upperI=imgWidth-(overLap)*boxWidth;
upperJ=imgHeight-(overLap)*boxHeight;
for i=1:(1-overLap)*boxWidth:upperI
for j=1:(1-overLap)*boxHeight:upperJ
C=eadXCorr(img1(i:i+boxWidth-1,j:j+boxWidth-1),img2(i:i+boxWidth-1,j:j+boxWidth-1));
[row,col]=maxOfMatrix(C);
Y(x,y)=(row-boxWidth);
X(x,y)=(col-boxHeight);
x=x+1;
% x increase corresponds to column increase
end
x=1;
y=y+1;
%row increase corresponds to column increase
end
end
X(x,y)=(col-boxHeight); x=x+1;
% x increase corresponds to column increase end x=1; y=y+1;
%row increase corresponds to column increase end end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment