(That question is also posted in Stack Overflow, since I don't have enough reputation, you can see more detail images in the link above)

I was inspired by that, and wonder if I can do it in python. So I did what I thought would work:

  1. evaluate the edges of the image;
  2. take the image as a matrix, evaluate the position of the points, so I got a list like that, each corresponding $x$ and $y$ represents a point:

    $x:[62, 64, 73, 75, 62, 64 ...]$ $y:[146, 146, 146, 146, 145 ...]$

  3. now the points are not ordered, so I sorted them by distance, make them connected and from several lines;

  4. then I did Fast Fourier transform yo the x and y coordinates and receive this:

    $fftX:[ 92897.00000000+0.j, -16312.65365042-5708.43473681j, 6403.02886691-11902.98323505j ...]$

    $fftY:[ 108724.00000000+0.j, 1475.70696042-23102.57060654j, 9852.51853181+15423.22752527j ...]$

  5. I thought these complex numbers represents $C_n$ below:


    and I thought I can transform into the triangle form below:


  6. Also I believe that among them $A_n$ is $\sqrt{Re(C_n)^2+Im(C_n)^2}$; and $\varphi_n$ is $arg(C_n)$, so I constructed the formulas like that:

    $X(t): 185794.0+17282.618327763143\cdot sin(2t+-2.804972121911925)+13515.908721371954\cdot sin(4t+-1.0772633933209355)+11927.354784757847\cdot sin(6t+1.847507468889795)+...$

    $Y(t): 217448.0+23149.653985824472\cdot sin(2t+-1.5070066804712279)+18301.586508165863\cdot sin(4t+1.0023275010871453)+9432.725456145046\cdot sin(6t+-2.3755960165370666)+...$

But it's not, the output plot is a mass, looks totally different from the original image, more like a fractal pattern...

I'm not here to ask how to code, just want to know how to construct the formula like wolframAlpha did. Is my concept wrong? Or lack of some steps( like, in the eassy, the author make B-splines either)? Any way to make it correct? Or I should post that in Signal Processing Stack Exchange?

  • $\begingroup$ sorted by distance? From what? $\endgroup$ – user3658307 Jun 10 '17 at 1:49
  • $\begingroup$ @user3658307 Ummm... you see the points are scanned from up to down, left to right at first, so if I plot them as line, they'll be like a image from a broken television. So I start with one point, then find the nearest one next to it, continue and yield one or more connected line. The picture in Stack Overflow may help. $\endgroup$ – Amarth Gûl Jun 10 '17 at 2:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.