### Approximate contour with n-sided polygon

I have segmented a contour which can be approximated by a 5-sided polygon (a square with a corner broken off).
Is there a function that makes use of this information? I currently uses ~~approxPolyNP, ~~approxPolyDP, but that function only uses a maximal distance between the approximation and the contour and not the expected number of corners.