1

Suppose I have an image like the following:

enter image description here

and suppose Mathematica knows the correct scale of the image. Is there a way I could get Mathematica to approximate this with, say, a Bezier curve? Similarly if I drew a red point on here, could Mathematica extract the coordinates of the point?

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
math
  • 763
  • 3
  • 12
  • Are you willing to extract points along the line manually or must this be done by code? – C. E. Aug 13 '20 at 18:25
  • Ideally Mathematica would do this. I really only need loops in the same homotopy class, so I could draw some other loop manually and just parameterise that loop to get points. However, I already have several pictures like the above with loops already drawn so if I could extract points automatically, it might be a time saver. – math Aug 13 '20 at 18:49
  • If manually ok, you can show Drawing Tools in Mathematica. And then use the Get Coordinates Tool. Also see https://mathematica.stackexchange.com/questions/1524/recovering-data-points-from-an-image – PaulCommentary Aug 14 '20 at 03:54

1 Answers1

5

If I understand your question right, you could identify pixels with different colors and extract the points.

Try bild="copy of the image" (sorry don't know how to show this code in simple form)

detect the dominant colors

dc = @DominantColors[bild]     

get the points

points = Map[ PixelValuePositions[bild, #, .1 (*Colordistance*)] &, dc ]

#3 is the right one

ListPlot[point[[3]]]

enter image description here

points[[3]] might be taken to get beziercurve-approximation

Ulrich Neumann
  • 53,729
  • 2
  • 23
  • 55