Continuing the question How to extract the edge from a set of points and its answer by Simon Woods, I would like to ask if there is a way to extract the boundary of
obtained as
ToExpression@Import@"http://pastebin.com/raw.php?i=741qaDt2";
boundary = Complement[spiel, Intersection @@
Outer[Plus, {{0, 1}, {0, -1}, {1, 0}, {-1, 0}}, spiel, 1]];
ordered in such a way that
ListPlot[boundary,Joined->True]
would give a polygon outlining the shape? The points extracted the way they are in the answer are not ordered along the boundary:
It would be even better to know if it is possible with MorphometricComponents[]
, because images I am working on look like that:
With MorphometricComponents[]
one can extract perimeter lenghts, baricenters and whatever he likes for the components, but not the ordered perimeter points themselves.
So the question is if there is a way to do that? Just to be clear: for each region in the picture, I would like to have the ordered coordinates of the points of the boundary boundary={{x1,y1},{x2,y2},...}
such that ListPlot[boundary,Joined->True]
would give polygons outlining the shapes.
FindCurvePath
(look it up) $\endgroup$ListPlot[boundary[[FindCurvePath[boundary][[1]]]], Joined -> True]
I get an ordered curve. The question remains aboutMorphometricComponents[]
. $\endgroup$boundary
the way it is described, you have already lost it. $\endgroup$