0% found this document useful (0 votes)
157 views14 pages

Fourier Descriptors: Ari Packer

Fourier descriptors are used to describe the shape of objects in images. The boundary of the shape is extracted and converted into Fourier descriptors, which are invariant to translation, rotation, and scaling. For a class project, the author created shape boundaries with different transformations and compared their Fourier descriptors to determine if they represented the same shape regardless of transformation. The code implemented a function to compute the Fourier descriptors of two boundaries and compare them while accounting for possible scaling, rotation, and translation differences.

Uploaded by

Gabriel Humpire
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
157 views14 pages

Fourier Descriptors: Ari Packer

Fourier descriptors are used to describe the shape of objects in images. The boundary of the shape is extracted and converted into Fourier descriptors, which are invariant to translation, rotation, and scaling. For a class project, the author created shape boundaries with different transformations and compared their Fourier descriptors to determine if they represented the same shape regardless of transformation. The code implemented a function to compute the Fourier descriptors of two boundaries and compare them while accounting for possible scaling, rotation, and translation differences.

Uploaded by

Gabriel Humpire
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

FOURIER

DESCRIPTORS

Ari Packer
What are Fourier Descriptors?
„ Fourier descriptors are used to
describe the shape of any object
found in an image.
How are the shapes described?
„ First, the boundary of the shape
must be extracted.
„ This boundary is then converted
into Fourier descriptors.
Why use Fourier Descriptors?
„ Fourier descriptors have several
properties that make them valuable
in shape description.
„ They are insensitive to translation,
rotation, and scale changes.
How are FD’s used in the real world?

„ Example: Spy planes and satellites.

Images from Google Maps (http://maps.google.com)


Project Summary
„ For this project, I…
„ Created boundaries of different rotation,
translation, scale, and shape.
„ Compared them.
Boundaries Used
„ The image below represents the boundaries that I
created.
Boundary Comparison
To compare two boundaries, I implemented a
function fourierCompare(a,b) where a and b
are two boundaries.
„ 1) Compute Fourier descriptors of a and b using the function
frdescp(x) which I found in the DIP Using Matlab book.

„ fd_a = frdescp(a);
„ fd_b = frdescp(b);
Boundary Comparison
„ To determine whether scaling is needed or even
possible, I found the max distance between each
point in a and each point in b using the distance
formula.
„ This allows me to determine if the shapes are equal
in size or if the size of one is a factor of the other.

„ *The code for this part is too long to fit on a slide.


Boundary Comparison
„ This program only works if one image’s size
is equal to or a factor of the other’s.
„ Since the scaling factor has been determined
(previous slide), we can multiply all of the
smaller image’s descriptors by it to make both
images equal size.

„ fd_a = fd_a * scalingFactor;


Boundary Comparison
„ To determine if the descriptors are equal but
have a different rotation, I spin one boundary
around 1 degree (variable) at a time and keep
one fixed. They are compared at each
rotation.
Boundary Comparison
„ To determine if the boundaries are the same
regardless of translation, all descriptors
except the (n/2)+1 descriptor are compared, n
being the number of points in the boundary.
„ Example of a boundary (left) and its Fourier descriptors (right).
1 1 -2.0000 + 2.0000i
1 2 1.4142 - 4.2426i
1 3 0 - 2.0000i
2 1 -2.0000 - 4.0000i
2 3 16.0000 +16.0000i
3 1 -1.4142 + 4.2426i
3 2 -2.0000
3 3 -2.0000 - 4.0000i
Code: fourierCompare()
„ function fourierCompare(a,b) „ else
„ [w numPoints] = size(a); „ scalingFactor = highestB / highestA;
„ fd_a = frdescp(a); „ fd_a = fd_a * scalingFactor;
„ fd_b = frdescp(b); „ end
„ highestA =0; „ display('boundry scaling passed.');
„ highestB =0; „ else
„ for v=1: numPoints „ display('one boundry is not a factor of the other. scaling failed.');
„ for h=1: numPoints „ end
„ if(v ~= h) „ else
„ if( sqrt( (a(v,1)-a(h,1))*(a(v,1)-a(h,1)) + (a(v,2)-a(h,2))*(a(v,2)- „ display('boundries are the same size, no scaling needed.');
a(h,2))) > highestA ) „ end
„ highestA = sqrt((a(v,1)-a(h,1))*(a(v,1)-a(h,1))+(a(v,2)- „ numAngles = 360*2;
a(h,2))*(a(v,2)-a(h,2))); „ angle = 0;
„ end „ for v=1: numAngles
„ if( sqrt((b(v,1)-b(h,1))*(b(v,1)-b(h,1))+(b(v,2)-b(h,2))*(b(v,2)- „ fd_b_temp = fd_b;
b(h,2))) > highestB )
„ fd_b = fd_b * exp(angle * j);
„ highestB = sqrt((b(v,1)-b(h,1))*(b(v,1)-b(h,1))+(b(v,2)-
b(h,2))*(b(v,2)-b(h,2))); „ angle = angle + (2*pi)/numAngles;
„ end „ fd_b = round(fd_b);
„ end „ same=1;
„ end „ for v=1: numPoints
„ end „ if(v ~= numPoints/2 +1)
„ highestA = round(highestA); „ if(fd_a(v) ~= fd_b(v))
„ highestB = round(highestB); „ same=0;
„ if(highestA ~= highestB) „ end
„ display('boundries are not the same size. attempting to scale.'); „ end
„ if(highestA > highestB) „ end
„ modu = mod(highestA,highestB); „ if(same == 1)
„ else „ display('boundries are the same.');
„ modu = mod(highestB,highestA); „ break;
„ end „ end
„ if(modu == 0) „ fd_b = fd_b_temp;
„ if(highestA > highestB) „ end
„ scalingFactor = highestA / highestB; „ if(same == 0)
„ fd_b = fd_b * scalingFactor; „ display('boundries are not the same');
„ end
„ display(' ');
The End

You might also like