I am trying to get all the lines in this image:
This is the code that I'm using:
threshold = 30
minLineLength =10
maxLineGap = 10
lines = cv2.HoughLinesP(img,1,np.pi/360, threshold, minLineLength, maxLineGap)
The problem is that I'm getting too many lines (~300):
But if I increase the threshold value it starts to miss some lines:
Is there any way of reducing the number of lines while keeping line-detection accurate?
Thanks in advance!
It works (mostly) fine for me in Python/OpenCV. Adjust your HoughP line arguments as appropriate.
I think you need to threshold your image first. And perhaps thin the white lines.
Input:
Resulting Hough lines in red:
You get a lot of parallel very close lines that you may want to merge somehow or thin out the list.