Ask Your Question
0

What is the format of lines in HoughLines()

asked 2018-04-05 06:48:20 -0500

open_ranger gravatar image

In the description of cv::HoughLines it says

Output vector of lines. Each line is represented by a two-element vector (ρ,θ) . ρ is the distance from the coordinate origin (0,0) (top-left corner of the image). θ is the line rotation angle in radians ( 0∼vertical line,π/2∼horizontal line ).

So what is the return type? Is it a Nx1 CV??C2 or Nx2 CV??C1? The line roate clockwise or anticlockwise? which direction would a π/2 line points to?

Hopefully someone can wirte a better documentation so the rest the programmer know how to use it right away.

edit retag flag offensive close merge delete

Comments

read doc and tutorial

"Hopefully someone can wirte a better documentation so the rest the programmer know how to use it right away." You are welcome

LBerger gravatar imageLBerger ( 2018-04-05 08:05:19 -0500 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2018-04-07 11:58:39 -0500

open_ranger gravatar image

updated 2018-04-07 12:27:20 -0500

After a bit of experiment here is what I found

lines in cv::HoughLines typically returns a N x 1 32F C2 Mat,N is the number of lines identified.Channel 1 which is named ρ and took the range between(-∞,+∞)represent the minimum distance beween the line and the origin.Channel 2 which is named θ represents the direction of the line relative to the orign and took and range of [0,π).At θ=0 the line will be vertically points to y+ (imagine line has direction, in Mat or image y+ is downwards) if the origin is on the RHS of the line ρ will be positive else will be negtive.As θ increase the line roates and shifts clockwise until it reachs θ=π¯ which is a vertically line points upwards.

Still a bit of wordy and not very intuitive.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-04-05 06:48:20 -0500

Seen: 89 times

Last updated: Apr 07 '18