i am new to Mathematica. I have generated the contours of this image with the following code
img = Import["https://upload.wikimedia.org/wikipedia/it/archive/0/09/20160903181541%21Twitter_bird_logo.png"];`
mesh = ImageMesh@img;
midpoints = Midpoint /@ MeshPrimitives[mesh, 1];
Graphics[{Thick, Darker[Red],
BSplineCurve[midpoints, SplineClosed -> False]}]
My question is: is there a way to get from Mathematica the vector of control points,the vector of knots,the vector of weights of control points and degree of this B-Spline/NURBS curve?
imgFixed = ColorReplace[FillingTransform[Binarize[img], 1], { White -> RGBColor[{0., 0.6745, 0.9294}], Black -> RGBColor[{0, 0, 0, 0}]}]
$\endgroup$bsf=BSplineFunction[midpoints]
, thenbsf["ControlPoints"]
bsf["Knots"]
, andbsf["Degree"]
to get them.bsf["Weights"]
just seems to returnAutomatic
. I don't know about how you want them exported to Matlab though. $\endgroup$