title: Get coordinates of a binary image and sort them clockwise starting from a point
body: <p>I'm working with binary images representing contours (taken through <code>cv2.Canny</code>), and i want to get the coordinates of each contour clockwise, starting from the first point as intersection of the image and a horizontal line located in the center of the image. Assuming that the image i want to use is a circular contour, i would like to get something like this (assuming Y decreasing vertically, as <code>matplotlib.pyplot.imshow</code> does):</p>
  <p><a href="https://i.stack.imgur.com/4XP9L.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4XP9L.jpg" alt="Desired behaviour" /></a></p>
  <p>I tried with the following code:</p>
  <pre class="lang-py prettyprint-override"><code>indices = numpy.where(edges == [255]) #edges is the contour image
  print(indices)
  </code></pre>
  <p>But this solution sorts the coordinates from the upper side of the image. I tried other solution found on the web too, but none of them seems to be usefull for this task.</p>