Plotting boundaries of segmented data

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Plotting boundaries of segmented data

This post has NOT been accepted by the mailing list yet.

I am trying to plot a 2-D array with segmentation data from a fluid flow. The data structure is continuous which means that the segments are connected regions, like in the picture below:

I use
plt.imshow(seg, cmap="Greys")
which returns a black area on a white background. What I would like to achieve instead is to plot only the boundary as a black curve, like when plotting a shape with pylab setting edgecolor=black and facecolor=white. Unfortunately, having the data in matrix format I am not sure whether this can easily be achieved without writing a separate function that detects whether a pixel belongs to the border or the interior. Is there an alternative to the imshow function which does this simply by setting some keywords?

Secondly I would like to smoothen the boundary curve which looks quite "rectangular" due to the coarse segmentation algorithm that has been applied to the fluid flow data. Can this be done with interp2d, if the segments are not based on an analytical expression?

Many thanks in advance!