José Gómez-Dans wrote:
> Hi,
> I have written a quick'n'dirty image segmentation algorithm. It seems to work
> fine. However, I am interested in getting contours of the segments
> (essentially, (x,y) pairs of the edges of each segment). I can plot the
> contours with MPL (pylab.contour()), but I'd like to have the locations of
> the edges, so that I can actually do something with them.
>
> Does anyone have any hints on how to go on about this?
cs = contour(Z)
for lev, col in zip(cs.levels, cs.collections):
s = col._segments
s will be a list of numpy arrays, each containing the (x,y) vertices
defining a contour line at level lev.
This illustrates a shortcoming of the contour and/or LineCollection
code; to get what I think you want, you have to use a private attribute,
_segments. It should be part of the public API. After some other changes
and reorganizations in mpl have settled down, I will fix this. Feel
free to send me a reminder in a month.
Eric
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users