title: Given a contour outlining the edges of an 'S' shape in OpenCV/Python, what methods can be used to trace a curve along the center of the shape?
body: <p>Given a contour outlining the edge of the letter S (in comic sans for example), how can I get a series of points along the spine of this letter in order to later represent this shape using lines, cubic spline or other curve-representing technique?  <em>I want to process and represent the shape using 30-40 points in Python/OpenCV.</em>  </p>
  
  <p>Morphological skeletonization could help with this but the operation always seems to produce erroneous branches.  Is there a better way to collapse the contour into just the 'S' shape of the letter?</p>
  
  <p><img src="https://i.stack.imgur.com/j9mr8.png" alt="enter image description here"></p>
  
  <p>In the example below you can see the erroneous 'serpent's tongue' like branches that are produced by morphological skeletonization.  I don't know if it's fair to say they are erroneous if that's what the algorithm is supposed to be doing, but for me I would not like them to be there.  </p>
  
  <p><img src="https://i.stack.imgur.com/4HVcx.png" alt="enter image description here"></p>
  
  <p>Below is the comic sans alphabet:</p>
  
  <p><img src="https://i.stack.imgur.com/sb59t.jpg" alt="enter image description here"></p>
  
  <p>Another problem with skeletonization is that it is computationally expensive, but if you know a way of making it robust to forming 'serpent's tongue' like branches then I will give it a try.</p>