I have a pixel segmentation created from a superpixel algorithm such as this. So for each pixel I have a label for which "superpixel" (i.e. group) it belongs to. I would like to convert the boundaries between superpixels into polylines instead of pixels so that they may be simplified with the Douglas-Peucker algorithm.
My problem is that I cannot figure out how to go from the superpixel labels to polylines. It is trivial to draw the superpixel boundaries (see attached image) but I am having trouble understanding how to convert those boundaries to polylines. Any suggestions would be really appreciated!