I have a segmentation of a cell layer (see Image). I extracted cell vertices and cell edges. Now based on the vertices alone I would like to draw a corresponding polygon cell structure with exactly 4 connected edges between polygons. Like it is in the original cell layer image. I tried insertShape and vision.ShapeInserter, with both I would draw polygons with a LineWidth of 1. The later works better, but I have still regions where I have more than 4 connected edges or that are problematic in other regards, while in my original segmentation of an image the boundary between cells is always perfectly 4 connected and only 1 pixel wide.
I tried eroding the objects but this of course results in a border that is wider than 1 pixel. Basically I want to draw nice 4 connected lines between the vertices and set these lines to 0. I tried bwmorph with 'skel' on the drawn polygons, but this resulted in lost vertices.
If this is not possible on pixel data it would be nice to find a way to compute the area of the different polygons.