Have you ever worked with 2D boundary shape representations and noticed that the same shape can be represented with reasonable accuracy by a much smaller number of points? Did you ever need to reduce the complexity of a 2D shape while retaining as many salient features as possible? If so then DecimatePoly is the function you have been looking for.
In the attached .ZIP folder you will find the primary, self-contained function titled DecimatePoly. Additionally, in the Demos folder you will find three demo files demonstrating the use of this function.
DecimatePoly_demo1: Demonstrates how to use DecimatePoly to simplify a 2D contour extracted from a binary image. Three binary images are included as examples. One of the them is shown in the screenshot. This is the only demo that requires Image Processing Toolbox to run.
DecimatePoly_demo2: Demonstrates the effectiveness of DecimatePoly in retaining sharp features.
DecimatePoly_demo3: Demonstrates how DecimatePoly can be used to improve time performance of in-polygon test at the cost of minor misclassification error.