3 ms·
How would one generate this equation from an image? http://www.wolframalpha.com/input/?i=snorlax+plane+curve http://www.wolframalpha.com/input/?i=snorlax+plane+
by ecto 13y ago
How would one generate this equation from an image? http://www.wolframalpha.com/input/?i=snorlax+plane+curve http://www.wolframalpha.com/input/?i=snorlax+plane+curve
- pkaye 13y agoThe equation is provided on the same page. It is using the Heaviside step function which allows you to piecewise define the curves and add them all together.
- zalzane 13y agoI've never done it, but here's how I would do it off the top of my head. -Vectorize the image into a set of bezier curves that have endpoints at intersections -Walk the bezier curves so that the entire image can be represented by a single "strip" of piecewise bezier sections. If there's any overlapping sections from having to rewalk the a curve, maybe apply some offsets/small modifications to those curves to give it a "sketched" look. -Rasterize the bezier curves in order at your desired resolution into a list of XY coordinates. Make sure the XY coordinates remain in order they were rasterized. -Split the coordinates of each rasterized pixel so that you have two lists, (t, x) and (t, y), where t is the index of the rasterized pixel. Now you can represent the X and Y coordinates of your sketch on two coordinate planes as a function of t. -For each coordinate plane X and Y, record the index where the second derivative of the rasterized graph changes. What this does is lets you distinguish subcurves on the line. For this to work it's probably important that the rasterization was done at a relatively high resolution. -For each subcurve, generate an extremely low frequency trigonometric function that can represent that subcurve. Ideally outside of that subcurve, the trig function should be at or very near zero. This might require layering some additional trig functions in order to eliminate any noise. -With the trig functions generated, return the results as a parametric function.