I have a camera that searches for an edge. It returns a list of $10$ points along the detected edge.
The result is ideally a list of $10$ points all on the same line. In reality it happens that some edges are misdetected by a lot. It is difficult to say how many are misdetected. It could be $1$ or $5$.
I need to find the most probable line that represents the edge, that goes through as many points as possible, but excludes the points that deviate a lot.
How can this be done mathematically?
This is a sample of how the points could be scattered:
EDIT:
I have a list of real points now: (The ones marked with an arrow are those that contain a outlier in the X values and need to be removed.)
X / Y
-----------
570,5/693,5 <---
585,5/683,5
591,5/673,5
586,5/663,5 <---
631,5/653,5 <---
611,5/633,5
617,5/623,5
622,5/613,5
622,5/603,5 <---

It sounds like you are looking for a regression line with a systematic way to identify highly influential points (outliers and high leverage points).
In R this would work a follows:
Can you see the high-leverage points? Like point $5,$ corresponding to (631, 653)? I marked it in red on the first plot - it is out of sync with the response $y$ in the rest of the data (outlier), and being positioned towards the end, it is pulling on the fitted line relatively more than the others (high leverage).
The second diagnostic plot (standardized residuals), tests the model for heteroskadisticity. The points should be distributed randomly above and below the line. Their individual influence is detected by calculating the ratio of the model residuals to the product of the standard deviation times the square root of 1 - "hat values" (measurement of leverage / values along the diagonal of the projection matrix). You can see that point $5$ is clearly above the others. Similarly Cook's distance identifies the same point as highly influential.
If we remove it from the dataset, we end up with a better fit (notice, for instance the change in R-squared from $69$ percent to $95$ percent.
Notice how the regression line (below) is reflecting a better fit (minimizing residuals) as it is no longer leveraged by that pesky point $5,$ which was an outlier, as well as a point of high leverage on the fitted line. Now it travels under three of the last four points, whereas it ran above them previously.