1
$\begingroup$

Okay, so I have a picture and I have obtained a curve from it using this code:

img = Import["http://silhouettesfree.com/animals/birds/duck-silhouette-image.png"]

img = Binarize[img~Blur~3]

tocurve[Line[data_], m_, t_] := param[#, m, t] & /@ Transpose[data]

lines = Cases[
   Normal@ListContourPlot[Reverse@ImageData[img], 
     Contours -> {0.5}], _Line, -1];

ParametricPlot[Evaluate[tocurve[#, 25, t] & /@ lines], {t, 0, 1}, 
 Frame -> True, Axes -> False]

The issues are as follows:

I am not sure if "GetCoordinates" is the best way to collect points. I want to collect the points to interpolate the shape of the image with splines.

Also, I am not sure, once I get the spline interpolated image, how to output a piecewise polynomial from the data. I understand since it is a parametric plot, I would need a polynomial for the x and y values. After searching, I could not find a tutorial on how someone would get equations from collected control points using Mathematica.

$\endgroup$

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.