Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Your question is not completely clear I assume that with low threshold you got too much lines while not enough lines with high threshold.

I do not think that there is an automated optimal value for the threshold that will suit your needs. You have experiment with all the parameters of the function to get the result what you want. You may even try different methods of Hough (e.g. probabilistic). Here is a description on what the parameters mean (for an older OpenCV version and here for the latest). There are longer tutorials on the algorithm behind like this and this.

Anyway it is better to opt for larger number of lines because you could postprocess the result and leave out unwanted lines and merge groups of similar ones. With small number of lines you have not so much option.