Code covered by the BSD License  

Highlights from
Elliptical Fourier shape descriptors

4.3

4.3 | 10 ratings Rate this file 36 Downloads (last 30 days) File Size: 3.66 KB File ID: #12746

Elliptical Fourier shape descriptors

by David Thomas

 

22 Oct 2006 (Updated 23 Oct 2006)

Forward and reverse elliptical Fourier transforms of x,y data

| Watch this File

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 submission has inspired the following:
Elliptical Fourier Shape Descriptors GUI, Elliptic fourier for shape analysis
MATLAB release MATLAB 7.2 (R2006a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (11)
09 Feb 2007 praveen kumar  
14 Jul 2007 Vidyaangi Patil  
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.

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?

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

13 May 2008 YOUSHIA youshbob

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

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?

09 Nov 2008 Filippo Leite  
24 Feb 2009 Abdul Rana

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

06 Aug 2009 sanqin zhao

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.

20 Feb 2010 michael scheinfeild

can we have some example how to use this code ?

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
measurements David Thomas 22 Oct 2008 08:45:05
fourier shape descriptors smoothing David Thomas 22 Oct 2008 08:45:05
fourier shape descriptors smoothing fraisa1985 Youssef 11 Jul 2010 13:21:35
measurements fraisa1985 Youssef 11 Jul 2010 13:21:38
fourier shape descriptors smoothing james l 25 Apr 2012 04:19:15

Contact us at files@mathworks.com