You can use bwboundaries() to find the bounary pixels and then maybe this FEX file to fit it to a polygon
I wonder, though, what created the binary image and whether geometric info about the polygon was used for that. If so, it would make sense to use that geometric info instead.
Use bwboundaries() to get the (x,y) coordinates of the outer perimeter. Then use the FAQ: http://matlab.wikia.com/wiki/FAQ#How_do_I_find_.22kinks.22_in_a_curve.3F, which points to an Answers posting where I gave demo code.
Play games and win prizes!Learn more