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?

  • $\begingroup$ Are you willing to extract points along the line manually or must this be done by code? $\endgroup$
    – C. E.
    Aug 13, 2020 at 18:25
  • $\begingroup$ 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. $\endgroup$
    – math
    Aug 13, 2020 at 18:49
  • $\begingroup$ If manually ok, you can show Drawing Tools in Mathematica. And then use the Get Coordinates Tool. Also see mathematica.stackexchange.com/questions/1524/… $\endgroup$ Aug 14, 2020 at 3:54

1 Answer 1


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


enter image description here

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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.