Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I think you had the right idea when you were looking at HoughLines. However, you would be better served with HoughLinesP. This is precisely the sort of thing that the Hough transform is for.

The reason to use the HoughLinesP is that it gives you a measure of length as well as angle. You can just add up the length of the lines in each rotation bin. You'll have to do a bit of math to figure out which bin it's in, but you shouldn't have any trouble with that.

To get a high resolution, go back with a second iteration (or more!) over the bin with the highest number of votes at a much narrower range and higher precision.

Here's the python tutorial for HoughLinesP.