Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HoughlinesP parameters "threshold" and "minLineLength"

I am using HoughLinesP function in OpenCV. After reading the documentation here, I am confused regarding the necessity of two parameters "threshold" and "minLineLength". Documentation says:

threshold – Accumulator threshold parameter. Only those lines are returned that get enough votes ( >threshold ).

minLineLength – Minimum line length. Line segments shorter than that are rejected.

Isn't one of them redundant? Isn't the number of votes a line gets is equal to number of pixels it contains? Given that "minLineLength" specifies which lines to reject, what is the use of "threshold"? Am I missing something here. A clarification would be appreciated.

like image 611
rajkn90 Avatar asked Jul 23 '14 23:07

rajkn90


2 Answers

If the cells of accumulator are wide and there are many closely spaced short lines, then the count of accumulator would be high. The min_line_length would help solve such issues.

Hope this clarifies the question at hand.

like image 156
Sumit Binnani Avatar answered Sep 17 '22 08:09

Sumit Binnani


Okay i read the documentation and how Randomized Hough Transform (will call it RHT) works and i have this idea, it might not be right though.

In RHT not all the binary points are taken into consideration, right. That's why it is faster. So, threshold means in the accumulator how many votes needed to consider this (rho, theta) as a line, this is the easy one.

The second one is a little bit confusing, but here is my though, minLineLength might be the length of the line calculated from the points that voted for it. Meaning, if we have a 5 points to vote for a certain line and all these points are so close, then the lineLength will be short may be 5 pixels. On the other hand, if 3 points voted for another line and the points are far a part, then the lineLength is large may be 20 pixels.

So we can't consider the voting threshold to be equal to the lineLength because not all binary points are taken into the calculation.

like image 38
Fadwa Avatar answered Sep 18 '22 08:09

Fadwa