The best approximation method to recover original polygon outline before rasterization procedure

180 Views Asked by At

I have a polygon, originally created as a Bézier Curve (black outline on the picture), and then saved as a polygon with enough points to call it smooth (at this scale). Then this polygon was rasterized (binarized), the borders of this polygon were converted to vector format (the red outline on the picture).

I want to restore the original line from rasterized using the approximation method.

What is the best way to do this?

By “best method” I mean a method that will return the same original boundary (black outline) or the closest result to the original line.

____________enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

This may be accomplished with Savitzky–Golay filter. There is implementation of this algorithm here. Because scipy.signal.savgol_filter only accept 1-demention arrays - the trick is to pass X and Y coordinates of the polygon to the function separately.

I am still figuring out which parameters is the best to use.