Simon Woods' [cool answer](https://mathematica.stackexchange.com/a/17780/18767) is based on two independent discrete Fourier transforms: one for $x$, one for $y$. This answer differs in that it uses only one, but on complex values. It's it not a very big difference that is a required step for [this kind of things](https://mathematica.stackexchange.com/questions/171755/how-can-i-draw-a-homer-with-circles/171756?noredirect=1#comment451143_171756).
img = Import["https://i.sstatic.net/wtJoA.png"];
img = Binarize[img~ColorConvert~"Grayscale"~ImageResize~500~Blur~3];
pts = DeleteDuplicates@Cases[Normal@ListContourPlot[Reverse@ImageData[img],
Contours -> {0.5}], _Line, -1][[1, 1]];
z = pts[[All, 1]] + I*pts[[All, 2]];
m = 10;
n = Length@z;
cn = 1/n*Table[Sum[z[[k]]*Exp[-I*i*k*2 Pi/n], {k, 1, n}], {i, -m, m}];
{f[t_], g[t_]} = {Re@#, Im@#} &@
Sum[cn[[i + m + 1]]*Exp[I*i*t], {i, -m, m}] // ComplexExpand;
ParametricPlot[{f[t], g[t]}, {t, 0, 2 Pi}]
- $m=10$:
[![enter image description here][1]][1]
- $m=20$:
[![enter image description here][2]][2]
To make the difference clear: Simon Woods' code with `m = 3` gives
{{4341/8 + 1593/8 Sin[37/11 + (44 t)/7] + 58 Sin[1/3 + (88 t)/7],
3225/11 - 867/8 Sin[6/5 - (44 t)/7] + 142/3 Sin[45/23 + (88 t)/7]}}
while the above code gives:
{23.2813 - 38.9784 Cos[t] + 16.5986 Cos[2 t] - 17.5251 Cos[3 t] -
195.161 Sin[t] + 55.6546 Sin[2 t] - 15.5714 Sin[3 t], -101.483 -
101.745 Cos[t] + 44.3024 Cos[2 t] - 34.0713 Cos[3 t] +
37.4785 Sin[t] - 16.4218 Sin[2 t] + 5.10139 Sin[3 t]}
The base functions are the same for `x` and `y` here.
_Note_ If someone manages to compute my `cn` using `Fourier` I'd be happy!
[1]: https://i.sstatic.net/fiqsO.png
[2]: https://i.sstatic.net/8hhut.png