2 http:// www.qinyujie.net
% y: Y-Translation
% G: The (non-normalised) Fourier descriptor of the shifted contour
% Translates the contour corresponding to F by (X,Y) Pixels
% This operation does not require an (inverse) DFT!
function [G]=shiftFD(F, x, y)
G=F;
N=length(F);
G(1)=F(1) + N .* (x + y*i);
end
%function [G]=scaleFD(F,scaleFactor)
% F: The (non-normalised) Fourier descriptor of a contour
% scaleFactor: Change in contour scale
% G: The (non-normalised) Fourier descriptor of the scaled contour
% Scales the contour corresponding to F by 100*scaleFactor %.
% This operation does not require an (inverse) DFT!
function [G]=scaleFD(F,scaleFactor)
G=100 .* scaleFactor .* F;
end
%function [G]=resizeFD(F, n)
% F: The Fourier descriptor of a contour
% G: The a resized Fourier descriptor with n elements
% Processes F to obtain G, which has been shortened to contain only n
% elements (assume F has more than n elements).
function [G]=resizeFD(F, n)
G=F;
len=length(F);
if (len > n)
T1=fftshift(F);
p=round((len-n) ./ 2);
T2=T1(p+1 : p+n);
G=ifftshift(T2);
end