The coefficients are complex numbers associated with every parameterized position on the closed contour. An intuitive interpretation would be to think of the coefficients as vectors in a real-imaginary co-ordinate frame, which describe a position on the contour as a sum of rotating vectors. The frequency of rotation corresponds to the degree of the coefficient - higher order coefficients rotate at increasingly faster frequencies.
Given the fact that the contours are composed of piece-wise linear segments, the solution from Kuhl & Giardina can be used to obtain a closed form solution using the slope of each segment in the contour and its length. Given the discrete sampling of the contour on a pixel grid, such a solution is valid and can be used to compute Fourier coefficients efficiently. The math was discussed vigourously in class, and I conciously omit the details here.
Reconstruction is comparatively trivial and often not required. However, it may be used to verify the sanity of our implementation. In practice, it is the coefficients that are used in applications involving such harmonics. Again, the math was described in great detail in class, and I conciously omit it from this report.
One thing to note during the reconstruction process is the interval of sampling while computing the contour. A sparse sampling may lead to broken contours, and hence I chose an interval of 0.01 for all reconstructions in this project. It actually may even have been an overkill !
We also make the coefficients invariant to translation, rotation and scaling in order to use them for comparison of the various contour pairs. As discussed in class, translation invariance is the easiest to obtain while rotational invariance requires a fair bit of computation. In this implementation, I have tried to ensure that the rotation invariance computation does not flip images accidently ! Given the elliptic components, scale invariance can be achieved by normalizing the semi-major axis.
| n=1 | n=10 | n=100 | n=1000 |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
As discussed earlier, it is evident that the first few coefficients are sufficient to obtain a faithful reconstruction of the contour. An order of 10s of coefficients are sufficient to capture all the features in the original contour upto pixel scale. Antialiasing artifacts may arise on a different grid-size, but these can be eliminated by post-processing.
| 1st Order Contour | ![]() |
![]() |
![]() |
![]() |
| Invariant Contours | ![]() |
![]() |
![]() |
![]() |
The above table displays reconstruction results after making the coefficients invariant to translation, rotation and scale. It is interesting to observe that the semi-major axis of the 1st order ellipse is the same in all cases, and also the starting point (I have tried to depict it as a yellow dot) !
Pairwise sum of square differences (SSD) is a measure of comparison for coefficients of different shapes. As shown in the table below, SSD is a fair measure of differentiation between various shapes. Intuitively, this represents the distance between the two pairs of coefficients represented as points in some higher-dimensional space. Even though I report the SSD values for pairs of contours described by 1000 coefficients, fewer coefficients will most likely result in a discrimination almost similar to this one.
| * | Vase | House | Cat | Duck |
| Vase | * | 146.4 | 114.5 | 186.8 |
| House | 146.4 | * | 205.3 | 174.5 |
| Cat | 114.5 | 205.3 | * | 229.3 |
| Duck | 186.8 | 174.5 | 229.3 | * |
However, invariance is obtained by an arbitrary process and can be a serious drawback.