Group Abstract Group Abstract

Message Boards Message Boards

Fit a spiral on given image?

Posted 6 years ago

Dear Wolfram community!

As a part of a project work, I'm trying to fit a spiral to the image below, in the Mathematica software. Shell of a snail

I figured out that I can track points on the image, after this, I converted these points to polar coordinates and I tried to fit a polar function to said points, however it does not really fit the image. As an attachment, I uploaded my Notebook Any help or tip is appreciated.

Attachments:
POSTED BY: Máté Gigacz
5 Replies
Posted 6 years ago

Thank you! I learned a lot from your solution, thank you again.

POSTED BY: Máté Gigacz
POSTED BY: Martijn Froeling
Posted 6 years ago
POSTED BY: Máté Gigacz

A slight modification of Rohits solution might simply be:

Show[img, ListLinePlot[adat, AspectRatio -> 1, PlotStyle -> Red, InterpolationOrder -> 3]]

enter image description here

So for hitting intermediate points you basically need interpolation. If you need some function describing this spiral, you can do it like so:

shell[t_] = Evaluate[Through[(ListInterpolation[#, {0, 1}, InterpolationOrder -> 3] & /@ Transpose[adat])[t]]];
ParametricPlot[shell[t], {t, 0, 1}]
POSTED BY: Henrik Schachner
Posted 6 years ago

It looks like quite a nice fit

Show[img, ListLinePlot[adat, AspectRatio -> 1, PlotStyle -> Red]]

enter image description here

Try smoothing the points using BSplineFunction

spline = BSplineFunction[adat]
Show[img, ParametricPlot[spline[x], {x, 0, 2 Pi}, AspectRatio -> 1, PlotStyle -> Red]]

enter image description here

You can experiment with the options for BSplineFunction to see if you can get a better interpolation.

POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard