Hint: to achieve good result, you may consider preprocessing (e.g. thresholding, etc.) the given image before edge detection.
(a) Extracting Boundary Pixels
To use FD method, you need to extract the coordinates {x,y} of every pixel
on the boundary. To do so, you will need to write a function in which the
boundary is traversed pixel by pixel to obtain their coordinates. After the
coordinates of a boundary pixel are recorded, you mark it and move on to
the next one by searching all 8 neighbors to find a non-zero neighbor which is
not yet marked. Keep doing this until you come back to the starting point
(marked previously).
(b) Fourier Descriptors
DFT the boundary pixels z(m)=x(m)+jy(m), (m=0, ...., N-1) to find the
Fourier Descriptors. Note that the number of boundary pixels $N$ may
not be a power of 2, so you need to use the DFT definition with N^2
computational complexity. (Use "/home/adder/classes/e186/programs/mydft.c").
Next, recover the boundary by IDFT only the low frequency components (with the remaining frequency components set to zero). (Hint: make sure you know where the low and high frequency components are in the {\em periodic} DFT spectrum.) Try to change the number of low frequency components used to see the fact that the more high frequency components thrown away, the less detail recovered. In other words, the first few low frequency components can be used to represent the location, the basic shape and the orientation of the 2D shape. Submit two images recovered using different number of low frequency components to show this effect.
(c) Skeletonization
Properly threshold the original image so that all pixels inside the shape
are 1 and all background pixels are 0. Then use both the thinning (N(P)
and S(P), etc.) and skeletonization (firelines) algorithms discussed in
class to find the ``skeleton'' of the figure.