How to get an ordered list of coordinates of a curve?
Hi, Given a 2D image of a closed or open curve, as the outline of a binary particle or a skeleton,I am wondering how to get an order list of the pixels coordinates (I found something in the opencv documentation <http://opencv.willowgarage.com/documentation/python/imgproc_structural_analy...>, but I am unable to call fincontours from python. For som reasons, I write import opencv then if I try opencv.findcontour, findcontour is not available in the list of my python ide<https://picasaweb.google.com/100950875858888510591/Spyder#5591405906862620322>( spyder <http://packages.python.org/spyder/>); I hope I am clear ) Thanks for your advice. Jean-Patrick
Read the opencv docs for the scikits.image opencv bindings to see what is available: http://stefanv.github.com/scikits.image/api/scikits.image.opencv.html They bindings for opencv in the scikit do not cover the entirety of the opencv library. For that, you would need to build and use the Python bindings developed by the OpenCV group (which are not necessarily compatible with scikits.image). To answer your question, what you need to do is write a simple chain coding algorithm, the details of which can be found in G & W or Jain & Kasturi Machine Vision. On Wed, Apr 20, 2011 at 12:12 PM, jip <jeanpatrick.pommier@gmail.com> wrote:
Hi, Given a 2D image of a closed or open curve, as the outline of a binary particle or a skeleton,I am wondering how to get an order list of the pixels coordinates (I found something in the opencv documentation <http://opencv.willowgarage.com/documentation/python/imgproc_structural_analy...>, but I am unable to call fincontours from python. For som reasons, I write import opencv then if I try opencv.findcontour, findcontour is not available in the list of my python ide<https://picasaweb.google.com/100950875858888510591/Spyder#5591405906862620322>( spyder <http://packages.python.org/spyder/>); I hope I am clear )
Thanks for your advice.
Jean-Patrick
unfortunately, FindContours is not in scikits.image. with opencv, there is somothing that I don't understand, I get: In [21]: import opencv In [22]: opencv.FindContours(...) ------------------------------------------------------------ Traceback (most recent call last): File "<ipython console>", line 1, in <module> AttributeError: 'module' object has no attribute 'FindContours' I understand this is not an opencv group, but if you know how to solve that issue ... Thank you Jean-Patrick
Findcontours works for me with opencv2. Check cv20squares.py in the opencv samples folder. On Wed, Apr 20, 2011 at 6:12 PM, jip <jeanpatrick.pommier@gmail.com> wrote:
Hi, Given a 2D image of a closed or open curve, as the outline of a binary particle or a skeleton,I am wondering how to get an order list of the pixels coordinates (I found something in the opencv documentation , but I am unable to call fincontours from python. For som reasons, I write import opencv then if I try opencv.findcontour, findcontour is not available in the list of my python ide (spyder); I hope I am clear )
Thanks for your advice.
Jean-Patrick
participants (3)
-
Chris Colbert
-
jip
-
Pieter Holtzhausen