3 edited tags
| link
2 edited tags
| link
    Tweeted twitter.com/#!/StackMma/status/163093205003407360
1
source | link

Character edge finding

The following line of code finds the edge of a character:

pic = Binarize[GradientFilter[Rasterize[Style["\[Euro]", FontFamily -> "Times"], 
                              ImageSize -> 200] // Image, 1]]

Mathematica graphics

The coordinates of the edges can be found as follows:

pdata = Position[ImageData[pic], 1];

Test:

Graphics[Point[pdata]]

Mathematica graphics

However, the points are not sorted in an order usable by Line or Polygon:

Graphics[Polygon[pdata]]

Mathematica graphics

This brings me to my question:

  • What would be an efficient method to sort the coordinates so that it would plot properly with Line or Polygon?

Additionally,

  • How to thin and smooth the set of points?
  • How to deal with characters with holes in them, like the ones below?

Mathematica graphics or Mathematica graphics