I have a picture that I elaborate with my program to obtain a list of coordinates.
There is a matrix represented in the image. In an ideal test I would get only the sixteen central points of each square of the matrix. But in actual tests I have some noise points.
I want to use an algorithm to extrapolate from the list of the coordinates the group formed by 16 coordinates that best represent a matrix.
Example of found points:
Example of desired result:
How to do this?
Note: The matrix in the image can be rotated a little too, so a rotation-independent algorithm would be great.