If the error / distortion of the points does not increase when you go from left to right or from top to bottom (that is, the average distance a between adjacent good points is known for sure), you can try the following:
- print each point P i in the square
[0,a[ x [0,a[ , taking the rest of the coordinates x and y when dividing by a (generating Q i ). Thus, good points will more or less be displayed on one point. - Among these generated points Q i, select one point
R with the nearest neighbors (for example, sum 1/distance for all distances to other points Q j , j & ne, i, and choose the one that has the maximum amount). - Now you can distinguish between good and bad points P i by superimposing Q i on R. (The points P i whose corresponding Q i is close to R will be good points.)
If the point R (with nearest neighbors) has a coordinate close to 0 or (i.e., R is close to the border of the square [0,a[ x [0,a[ ), it is better to start from the beginning and add a/2 to (each P i ) before calculating the remainder to bring the point R to the center of the square. (Or you can calculate the minimum distance from various possibilities to leave the square [0,a[ x [0,a[ on one side and return to it on the opposite side.)
source share