Reputation: 565
My question is about Hough transform in OpenCV 2.4.9 (Python).
Here is an extract from tutorial:
cv2.HoughLinesP(image, rho, theta, threshold[, lines[, minLineLength[, maxLineGap]]]) → lines
I do not really understand what "lines[," means. I use the function in the following manner:
lines = cv2.HoughLinesP(edges, 1, np.pi/180, 25, 2,25,115)
But what does parameter "2" here really mean? Seems nothing change when I assign different values for that parameter.
Tnanks..
Upvotes: 4
Views: 2604
Reputation: 18477
You have to use it like this
lines = cv2.HoughLinesP(edge_image, rho=1.0, theta=math.pi/180.0,
threshold=thresholdVal,
minLineLength=minlinelengthVal,
maxLineGap=maxlinegapVal)
If you read up about Hough Transforms and probabilistic hough transforms, you'd realize that an accumulator is used to accumulate all the edge points. rho
is the distance resolution of the accumulator in pixels and theta
is the angle resolution of the accumulator in radians.
And as far as cv2.HoughLinesP(image, rho, theta, threshold[, lines[, minLineLength[, maxLineGap]]]) → lines
docs is concerned, it is sort of function overloading but since python provides optional arguments, this is used. lines[
just means that you can pass a numpy array where the lines will be stored. So now, if you want pass other parameters and skip lines
, you'd have to pass them by the parameter name.
Upvotes: 6