# How can I find lines of a certain angle(s)?

ImageLines implements the Hough transform, but how do I search for only lines within some threshold of a certain angle(s)?

• Could you please post some sample images, code you have written so far? You might try to find all the lines and simply take the ones within your threshold. – s0rce Apr 22 '13 at 17:25
• You could do the Radon transform which allows specification of the range over which to look. – bill s Apr 22 '13 at 17:50
• There's a Radon function might be a start point. – Silvia Apr 22 '13 at 17:53
• An explanation and example appear in an answer on the stats site. – whuber Apr 22 '13 at 19:50
• Angle from what, horizontal? – J. M. will be back soon Apr 22 '13 at 23:37

To search only for lines at given angles, say between theta0 and theta1, you could:

1. Compute the Hough transform using Radon[img, dims, {theta0, theta1}, Method -> "Hough"]
2. Detect peaks in the Hough transform, ie. the local maxima with high values (MaxDetect and Binarize may help, for example)
3. Extract the positions of the detected peaks and convert them from the image coordinate systems to {rho, theta} values (Rescale may help)