Converting an open curve to a list of ordered pixels: a Python test code with numpy
I have the image of an open curve in a numpy array and I need to build a list of points coordinates ordered according to their position on the curve. I wrote a draft script using numpy and mahotas. It may not be optimal. I know that OpenCV can do this for a closed curve. Can OpenCV do the same (faster) with an open curve? For example, if the original curve is: [[0 0 0 0 0 0 0] [0 1 0 0 1 0 0] [0 0 1 0 0 1 0] [0 0 0 1 1 0 0] [0 0 0 0 0 0 0]] Using np.where(myarray==1) , I can get the indices of the pixels: (array([1, 1, 2, 2, 3, 3]), array([1, 4, 2, 5, 3, 4])) But this not what I need. My