c++ - why hough transform detects two lines while there is only one line -


i detect line , extract 2 ended points. common approach using hough transform. luckily there sample in opencv regarding matter, therefore i've drawn line 2 ended points p1(100,200), p2(400,200). thought aforementioned method provid me these points. sample image

enter image description here

the hough transform provides me 2 images

enter image description here

enter image description here

for canny filter,

enter image description here

in code, seems there 2 lines detected. explains why red line thicker indicates fact there 2 lines rather one. when print out number of lines, shows me 2 follows

lines.size(): 2 p1:<99,201>  p2:<401,201> lines.size(): 2 p1:<102,198>  p2:<398,198> 

why i'm getting 2 lines?

it might due width of bins in houghspace. choose 1 of default opencv functio, i.e.

houghlines(x, x, 1, cv_pi/180, x, x, x );

the arguments not x define width of bins see. there says:

rho : resolution of parameter r in pixels. use 1 pixel.

for first argument , second:

theta: resolution of parameter \theta in radians. use 1 degree (cv_pi/180)

i don't values chose, might want choose larger ones.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -