Reputation: 128
I'm trying to construct navigation meshes from mapping data. One of the steps involves converting a binary image (where 0 represents occupied space and 1 represents free space) into a planar straight line graph.
I'm trying to figure out a way to do this that is somewhat reliable. My current thoughts are to use a Canny edge detector, and then run that through OpenCV's Hough line transform. However, that has no guarantee that the lines detected are connected in a way representative of the original shape.
It is safe to assume that the map is relatively smooth, and that none of the regions touch one another.
EDIT - Here is an example image:
White regions represent free space
Black regions represent occupied space
Upvotes: 0
Views: 3096
Reputation:
Edge detection is unnecessary/harmful on this binary image, just use contour following.
Then you turn the Freeman chains into polylines by the Douglas-Peucker line simplification method.
Upvotes: 4