Image Processing Reference
In-Depth Information
bar(ax);
axis([0,n,-scale,scale]);
%Graph coefficient ay
subplot(3,3,5);
bar(ay);
axis([0,n,-scale,scale]);
%Graph coefficient bx
subplot(3,3,6);
bar(bx);
axis([0,n,-scale,scale]);
%Graph coefficient by
subplot(3,3,7);
bar(by);
axis([0,n,-scale,scale]);
%Invariant
CE=zeros(1,n);
for k=1:n
CE(k)=sqrt((ax(k)^2+ay(k)^2)/(ax(1)^2+ay(1)^2))
+sqrt((bx(k)^2+by(k)^2)/(bx(1)^2+by(1)^2));
end
%Graph of Elliptic descriptors
subplot(3,3,8);
bar(CE);
axis([0,n,0,2.2]);
Code 7.3
Elliptic Fourier descriptors
of a curve. The code implements Equations 7.49 and 7.64 in a straightforward way. By
default, the number of coefficients is half of the number of points that define the curve.
However, the number of coefficients can be specified by the parameter n . The number of
coefficients used defines the level of detail of the characterisation. In order to illustrate this
idea, we can consider the different curves that are obtained by using a different number of
coefficients. Figure 7.17 shows an example of the reconstruction of a contour. In Figure
7.17 (a) we can observe that the first coefficient represents an ellipse. When the second
coefficient is considered (Figure 7.17 (b)), then the ellipse changes into a triangular shape.
When adding more coefficients the contour is refined until the curve represents an accurate
approximation of the original contour. In this example, the contour is represented by 100
points. Thus, the maximum number of coefficients is 50.
Figure 7.18 shows three examples of the results obtained using Code 7.3 . Each example
shows the original curve, the x and y co-ordinate functions and the Fourier descriptors
defined in Equation 7.64. The maximum in Equation 7.64 is equal to two and is obtained
when k = 1. In the figure we have scaled the Fourier descriptors to show the differences
between higher order coefficients. In this example, we can see that the Fourier descriptors
for the curves in Figures 7.18 (a) and (e) (F-14 fighter) are very similar. Small differences
Search WWH ::




Custom Search