I have been working with houghlines in OpenCV and I cant seem to get a more accurate line reading, sometimes there are two duplicate lines on top of each other. I have looked at tutorial on the opencv website but it gives a similar result.
To remove those duplicate lines, there are two things that may help you:
theta
argument of Hough Line method. For example using π/180
would result in finding lines that differ only by one degree in their slope. You may use 5*π/180
to find lines in 5 degree resolution.As an example, the following lines are detected by using the raw image and a 1-degree resolution:
After a bit of blurring and using a 3-degree resolution you can get a result like the following:
By changing the threshold, you can get more or less lines.
About fitting curves you pointed in the comments section, yes you can fit curves, but not with hough lines method. You need to find a parametric definition of that shape and try to run the voting procedure in hough transform yourself. The only other shape that opencv helps you to find is circle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With