In particular, I am trying to extract all the relevant line segments from screenshots of the asteroids game. I looked at various edge detection methods, but none of them are suitable for my problem for two reasons:
They detect smooth contours, while I just need to identify segments of a straight line and only those that are in a certain range of length. Now these restrictions should make my task much easier than in the general case, but I donβt want to just use a detector with a full-sized front, and then clear the result of the curved lines, as that would be overly expensive. Speed ββis paramount to my goals.
They display a modified image where the edges are glare, while I want a set of pixel coordinates representing the endpoints of the detected line segments. Alternatively, a list of all the pixels included in each segment will also work.
I have a suspicion that one of the possible solutions would include hough transform , but I donβt know how to use this to get the actual locations of the line segments (i.e. end points in the pixel space). Although, even if I did, I have no idea if this was the easiest or most effective way to do things, therefore, the general wording of the title of the question.
Finally, here is a sample image:

Please note that all major lines are similar in length and density and that the overall image contrast is very high. I hope that the solution to my problem will use these features, because again, efficiency is of utmost importance.
One warning: while most line segments in this context are part of a polygon, I donβt want a solution based on this fact.
source share