I want to “smoothen” polygons so that they remain most of their “outer” appearance, but removed of “inner corridors”.
To put it into context: The picture below shows a polygons that have been created out of a set of multiple points. The polygons below represent roughly a room, and those inwards parts of each polygon were once doors and other things.
Now I want to re-improve these polygons, so they look again like rooms.
My question is: What (set of) algorithm(s) fits my needs? Creating a convex hull or bufer polygon is not what I want (though I tried). Buffer polygons do not keep the outer appearance of the polygons, and convex hulls don’t remove these inwards parts.
That’s what it looks like:
And this is a badly photoshopped image of what I want it to look like.
Notice the small inner corridors are removed.
Edit: Common simplification also won’t work, probably. This is how my polygons simplified with Douglas Peucker look like. The distance tolerance is aggressive already, but the inner dents are still not gone. This is not surprising and quite expected, since the inner dents are long.
Edit 2:
It’s like I want to remove the inner dent of this example:
2
Answers
What you are seeking goes under the phrase polygon simplification, on which there is a vast literature.
A start can be found at this link,
from which the below images are copied.
There are many sophisticated algorithms aimed at achieving particular optimization criteria,
many surveyed in the
Handbook of Discrete and Computational Geometry.
Removing the “dents” (as in your “edit 2”) can be done with methods that operate on a per-pixel level, called “mathematical morphology”. The wikipedia webpage [1] is well explained, take a look in particular at the opening and closing operations that may fit your needs.
[1] https://en.wikipedia.org/wiki/Mathematical_morphology