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
the hough transform provides me 2 images
for canny filter,
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
Post a Comment