Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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

share|improve this question
1  
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
1  
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. Apr 22 '13 at 23:37
add comment

1 Answer

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)
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.