Skip to content
Snippets Groups Projects
Commit 52427a34 authored by Yoann Guilhem's avatar Yoann Guilhem
Browse files

Got rid of roll function (use built-in funciton circshift instead).

parent 7b335d32
No related branches found
No related tags found
No related merge requests found
......@@ -45,7 +45,7 @@ cc=abs(ifft(fft(z1).*conj(fft(z2))));
% translation of the zero displacement to the center of the vector because this is where the maximum will be
% to avoid to look at start and end of the vector
c=rem(c+n/2-1,n)+1;
cc=roll(cc,n/2,0);
cc = circshift(cc, [round*(n/2) 0];
% parabolic fit using w points around the maximum to go sub-pixel
w=3;
......
......@@ -259,7 +259,8 @@ end
function sfUpdateFigure
colormap gray;
im_tmp=roll(app.im1,app.vshift*app.zoom,app.hshift*app.zoom);
shiftVector = round([app.vshift app.hshift] * app.zoom);
im_tmp = circshift(app.im1, shiftVector);
switch app.mode
case 'add'
imshow(app.im0+im_tmp,app.clima);
......
% function rm=roll(matrix,r,c)
% cycles a matrix (or vector) r rows down and c columns to the right
% rm(i,j)=rm(i-r,j-c)
% origin: peter
function rm=roll(matrix,r,c)
[n,m]=size(matrix);
if r>0
rm=[matrix(n-r+1:n,:) ; matrix(1:n-r,:)];
elseif r<0
rm=[matrix(1-r:n,:) ; matrix(1:-r,:)];
else
rm=matrix;
end
if c>0
rm=[rm(:,m-c+1:m) rm(:,1:m-c)];
elseif c<0
rm=[rm(:,1-c:m) rm(:,1:-c)];
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment