Code covered by the BSD License

Highlights from Elliptical Fourier shape descriptors

4.38462
4.4 | 13 ratings Rate this file 42 Downloads (last 30 days) File Size: 3.66 KB File ID: #12746 Version: 1.0

Elliptical Fourier shape descriptors

David Thomas (view profile)

22 Oct 2006 (Updated )

Forward and reverse elliptical Fourier transforms of x,y data

File Information
Description

These two functions impliment the system of elliptical Fourier shape descriptors first described by Kuhl and Giardina in "Elliptic Fourier features of a closed contour" Computer Graphics and Image Processing 18:236-258 1982. fEfourier is the forward transform which creates a "shape spectrum" of a closed x,y outline, rEfourier takes a specified number of harmonics from the spectrum and reconstructs the x,y outline. The functions are not only useful for the creation of shape descriptors but also for smoothing outlines or reducing an arbitrary outline to a specified number of points.

Acknowledgements

This file inspired Elliptical Fourier Shape Descriptors Gui and Elliptic Fourier For Shape Analysis.

MATLAB release MATLAB 7.2 (R2006a)
06 Aug 2015 Simon Dixon

Simon Dixon (view profile)

Good work

My rating is based on the function using the correction by Sungeun Eom below. The function is used in this scientific paper whose approach can be reverse engineered to see how the input files should look etc.
Costa, C., et al. (2011). "Shape Analysis of Agricultural Products: A Review of Recent Research Advances and Potential Application to Computer Vision." Food and Bioprocess Technology 4(5): 673-692.

I have also struggled with the normalisation functions and had to disable these to get meaningful results and to get the rEfourier script to work.

I assume that the input outline to these functions is an array of (x,y) coordinates and not a chain code as is described in the Kuhl... paper originally. Is that correct. An other thing does the outline need to be continues link of pixels or can it be a link of vectors?

This is great work and nice of you to share it with us.

04 Dec 2013 Thomas

Thomas (view profile)

Have used the code and it seems to produce very nice results. Have applied the corrections mentioned by Sungeun Eom.

20 Feb 2010 michael scheinfeild

michael scheinfeild (view profile)

can we have some example how to use this code ?

Comment only
06 Aug 2009 sanqin zhao

sanqin zhao (view profile)

Excellent codes. I have also found the same problem that You didn't check whether it is a semimajor or semiminor axis.Meanwhile, the code can use the vectorization to speed up.For example, 'rDeltaX = diff(b(:,1)); rDeltaY = diff(b(:,2));' can replace the for loop.

24 Feb 2009 Abdul Rana

Abdul Rana (view profile)

Is it posssible for you to upload a detailed help description along with this file?

09 Nov 2008 Filippo Leite

Filippo Leite (view profile)

07 Oct 2008 Xiaoming Liu

Very good, easy to use. one question, if I need to use it as features, how to organize the 4 coefficients?

13 May 2008 YOUSHIA youshbob

YYOOUU SSSSSSSSTTTTTTTIINNNKKKKKKKKKKK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

04 Mar 2008 Sungeun Eom

Thanks for your work, but I have found two bugs in calculating rTheta1 and rPsi1. You didn't check whether it is a semimajor or semiminor axis. This is one fix for the problem for your information:

1) rTheta1 (line 137-138)
rTheta1 = 0.5 * atan(2 * (rFSDsTemp(1,2) * rFSDsTemp(2,2) + rFSDsTemp(3,2) * rFSDsTemp(4,2)) / ...
(rFSDsTemp(1,2)^2 + rFSDsTemp(3,2)^2 - rFSDsTemp(2,2)^2 - rFSDsTemp(4,2)^2));
rTheta2 = 0.5 * (pi + atan(2 * (rFSDsTemp(1,2) * rFSDsTemp(2,2) + rFSDsTemp(3,2) * rFSDsTemp(4,2)) / ...
(rFSDsTemp(1,2)^2 + rFSDsTemp(3,2)^2 - rFSDsTemp(2,2)^2 - rFSDsTemp(4,2)^2)) );
x11 = rFSDsTemp(1,2)*cos(rTheta1) + rFSDsTemp(2,2)*sin(rTheta1);
y11 = rFSDsTemp(3,2)*cos(rTheta1) + rFSDsTemp(4,2)*sin(rTheta1);
axisDist1 = x11^2 + y11^2;
x22 = rFSDsTemp(1,2)*cos(rTheta2) + rFSDsTemp(2,2)*sin(rTheta2);
y22 = rFSDsTemp(3,2)*cos(rTheta2) + rFSDsTemp(4,2)*sin(rTheta2);
axisDist2 = x22^2 + y22^2;
if (axisDist2 > axisDist1)
rTheta1 = rTheta2;
end

2) rPsi1 (line 148)
if (rStarFSDs(3,2)~=0)
if (rStarFSDs(1,2)>=0)
rPsi1 = atan(rStarFSDs(3,2) / rStarFSDs(1,2));
else
rPsi1 = atan(rStarFSDs(3,2) / rStarFSDs(1,2)) + pi;
end
else
if (rStarFSDs(1,2)>0)
rPsi1 = atan(rStarFSDs(3,2) / rStarFSDs(1,2));
else
rPsi1 = atan(rStarFSDs(3,2) / rStarFSDs(1,2)) + pi;
end
end

07 Dec 2007 Trevor Beugeling

The algorithm works great. However, I am having some difficulties using the normalization options. If I enable either the size or orientation normalization (or both), the data returned after using the rEfourier function is not correct. Is there some extra processing that is required when converting normalized descriptors back into a closed contour?

28 Sep 2007 Graeme Penney

Overall excellent, though I suspect there may be a bug. I get much more sensible results if I omit the -1 from line 39 of fEfourier.m
iNoOfPoints = size(rDeltaT,1) - 1.

14 Jul 2007 Vidyaangi Patil
09 Feb 2007 praveen kumar