[Solved] Simple algorithm for approximation image contour for line segment


A possible approach.

Find the convex hull of these points.

Then find the two vertices which are the furthest apart. This gives a first diagonal.

Then find the two other vertices that are the farthest from the first diagonal. This gives a second diagonal.

Now you can just use the quadrilateral formed by these four vertices.

If you want a tighter fit, you can consider the subsets of points in the four quadrants defined by the diagonals, and compute best fit lines, for example by least squares.

enter image description here

1

solved Simple algorithm for approximation image contour for line segment