While developing an optical character recognition system, I had to implement several feature extractors in order to classify the letters. One of them was an elliptic Fourier descriptor. You can download the MATLAB version here.
Since I could not find any working implementation of a Fourier descriptor for shape recognition, I'm publishing my implementation here.
This is a basic implementation of the descriptor presented in
O. D. Trier, A. K. Jain, T. Taxt, Feature Extraction Methods for Character Recognition - A Survey, Pattern Recognition, Vol. 29, No. 4, pp. 641 - 662 (1996).
You can find the paper here.
How to extract feature vectors
You can extract the feature vectors using the
[a,b,c,d,T] = ellipticFourierDescriptor(filename, N, p, rotation) function.
filenameThe name of the image file which contains the shape to recognize. The MATLAB-contour-algorithm is used to detect the outer contour.
NThe number of coefficients
pThe number of sampling points in percent. e.g.
p = 0.15
rotationWhether or not the features shall be rotation invariant
a,b,c,d carry the features.
T is the contour length, which is only used to plot the contour.
How to plot the contour
Once the features have been extracted, you can plot the contour using the
plotEllipticFourierDescriptor(a,b,c,d,T,s) function where
a,b,c,d,T is the result of the feature extractor and
s is the stepsize.
s = 0.1 should be sufficient for most plots.