Image Processing Reference
In-Depth Information
|
c
*
| =
(
a
*
)
2
+ (
b
*
)
2
(7.43)
k
k
k
provide a rotation, scale and translation invariant description. The function Ang
FourierDescrp in Code 7.2 computes the Fourier descriptors in this equation by using
the definitions in Equation 7.35. This code uses the angular functions in Code 7.1 .
%Fourier descriptors based on the Angular function
function AngFuncDescrp(curve,n,scale)
%n=number coefficients
%if n=0 then n=m/2
%Scale amplitude output
%Angular functions
AngFuncDescrp(curve);
%Fourier Descriptors
if(n==0) n=floor(m/2); end; %number of coefficients
a=zeros(1,n); b=zeros(1,n); %Fourier coefficients
for k=1:n
a(k)=a(k)+G(1)*(S(1))*cos(2*pi*k*S(1)/L);
b(k)=b(k)+G(1)*(S(1))*sin(2*pi*k*S(1)/L);
for i=2:m
a(k)=a(k)+G(i)*(S(i)-S(i-1))*cos(2*pi*k*S(i)/L);
b(k)=b(k)+G(i)*(S(i)-S(i-1))*sin(2*pi*k*S(i)/L);
end
a(k)=a(k)*(2/L);
b(k)=b(k)*(2/L)-2/k;
end
%Graphs
subplot(3,3,7);
bar(a);
axis([0,n,-scale,scale]);
subplot(3,3,8);
bar(b);
axis([0,n,-scale,scale]);
%Rotation invariant Fourier descriptors
CA=zeros(1,n);
for k=1:n
CA(k)=sqrt(a(k)^2+b(k)^2);
end
%Graph of the angular coefficients
subplot(3,3,9);
bar(CA);
axis([0,n,-scale,scale]);
Code 7.2
Angular Fourier descriptors
Search WWH ::




Custom Search