Search code examples
mathmathematical-optimizationequation

How to draw a picture with mathematical equations


Recently I have seen some pictures that could be drawn by some mathematical equations like the Batman Logo and the Heart.

Is there a specific way to find the equations which draw a desired picture? (e.g. I want to draw the letter S with some mathematical equations).

Thanks.

p.s. I guess it is an optimization problem. First get some samples from the border of the desired picture and then finding a function which has the minimum difference from those samples.


Solution

  • Assuming your picture is in black and white you may want to have a look at this http://www.mathworks.co.uk/help/stats/nlinfit.html

    You can get the points and perform regression on them. Linear regression will get you a line. Nonlinear will get you something more accurate.

    If the picture is more complex, then you will have to extract some features and it gets more complicated.