I have an array of Points. I KNOW that these points represent many lines in my page.

How can I find them? Do I need to find the spacing between clouds of points?

Thanks Jonathan

+1  A: 

Maybe the Hough Transform is what you are looking for? Or a linear regression?

[EDIT] As it turns out the problem is to identify lines inside a list of 2d coordinates I would proceed this way.

A linear regression can only be used for making the best linear adjustment for a set of points, not to detect many lines. Maybe use hough to get roughly the lines, check if many points align on these lines. Have a look at the points left aside. Do they have to belong to a line?

Using an accumulator to determine the lines seems to me a good solution in general but if your points follow some relations, try to adapt the accumulator to it to make it fit better.

The problem definition is not so specific, it is difficult to tell exactly how to proceed. The use of an accumulator for such kind of problems seems a basis to me that must be kept.

At least the problem is interesting!

I have tried HoughTransform, but it misses many lines...
In the past I had to detect road signs inside pictures (which contain regular forms like triangles and circles, ...) It worked quite well. Your array of points is not an image, is it? I mean it is a set/list of 2D points coordinates or a picture?
yes exactly.only points. Do you have C# code for that ?
No I am sorry. I will try to formulate how I would proceed if I had to do the job in the response, as there is more place.
I think this is an excellent case for the Hough Transform. If you are missing lines have you played with you bin radius? I suggest you look at AForge.NET it's written in C# and is a brilliant image processing library (contains a Hough Transform implementation)
Question to jdehaan: what do you mean but an accumulator ? the hough transfom ?
The accumulator is where you add the results of the transformations

This is the same as considering what are all the overlapping lines between 2 points.

  1. Go over all point-to-point lines and convert it to a structure that contains:

    a) the y intercept

    b) the slope

    c) the lower x-bound

    d) the upper x-bound

  2. Sort by y-intercept and slop.

Now you know that 2 lines can overlap only if they have the same y intercept and the same slope.

  1. For each set of lines with the same y-intercept and slope, check if the x-bounds overlap. If they do then you don't have separate lines, you have 1 line with more than 2 points.

  2. Handle vertical lines as a special case.