Search code examples
algorithmmathimage-processinggeometryline

Line Passing Through Given Points


enter image description here

I am trying to find the angle of the outer line of the object in the green region of the image as shown in the image above…

For that, I have scanned the green region and get the points (dark blue points as shown in the image)...

As you can see, the points are not making straight line so I can’t find angle easily.

So I think I have to find a middle way and that is to find the line so that the distance between each point and line remain as minimum as possible.

So how can I find the line so that each point exposes minimum distance to it……?

Is there any algorithm for this or is there any good way other than this?


Solution

  • The obvious route would be to do a least-squares linear regression through the points.