Answer the question
In order to leave comments, you need to log in
How to cluster points by belonging to different (unknown) lines?
There is a set of points on the Cartesian plane, which are the coordinates of the sides of some figure (which one is unknown). There are outliers among the points and random deviations are inherent in the points.
The figure shows that the figure consists of four straight lines.
Task : cluster the points according to their belonging to the most suitable line, and, if possible, obtain the parameters of these lines.
IMPORTANT! There is too little data (for example - 100 points), so the Hough transform does not work well. Some other method is needed.
Thanks in advance for any help or possible hints.
Answer the question
In order to leave comments, you need to log in
Approximately as follows:
1. We take a group of closely lying points.
2. We build a straight line from a group of points.
3. We throw out from the group a point (points) that is too much out of correlation.
4. Add the nearest untested point to the group.
5. Repeat from step 2 until the points run out.
This determines the direction of one of the lines.
6. All points that correspond to the found line are excluded from the total mass of points and the process is repeated from point 1.
Thus, all lines will be found.
7. From the array of lines, you need to exclude lines consisting of a small number of points. Most likely these are lines from ejection points. And the points included in these lines must be excluded from the general array of points.
8. After all the lines are found, you need to find the points included in them from the general array of points (taking into account the previous paragraph), because points can be included in several lines, and due to item 6, the last line will not count many of its points.
Notes on item 3:
* If as a result of adding one point 3 or more points fall out, then you need to throw out the added point, and not those that are no longer suitable for the line.
* If after adding a new point, no one falls out of the correlation, then no one needs to be thrown out.
If you don't feel sorry for the time, you can try this: We go
through the angles from 0 to 180 in steps, for example, 1 degree.
We project the points onto a straight line going at this angle to the horizontal.
We are looking for a sufficiently short segment on the projection, into which quite a lot of points have fallen.
We are looking for a straight line using the least squares method that best approximates the points that fall into this segment.
We consider the root-mean-square distance from these points to the found line (sigma)
We are looking for all points from the original set, the distance from which to this line is less than 3 * sigma.
We construct the best approximation of a straight line for them.
You can repeat the last three steps several times.
The first part of the algorithm has not been tested. In essence, this is the same Hough transformation, but divided into stages. The second one has been used many times.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question