Detecting all lines in line-based structure using OpenCV

134 views Asked by At

I've been trying to detect all lines in a line-based structure and I've been falling short. I've learned about the HoughLinesP function, however it doesn't seem to work good enough for more complex images. I've been playing with the parameters and it either doesn't detect all the lines, or detects all the lines but splits them into many very small lines that are hard to connect. I've been trying to implement a function that'd join all the consecutive lines into one but with many edge cases and small problems it doesn't work very well either. I've been wondering, is there maybe a better way to approach this problem? Or maybe since this seems like a very simple problem there exists some kind of solution that I haven't found?
Base image:
enter image description here
Detection with high threshold (longer lines, some lines not detected): enter image description here
Detection with low threshold (shorter lines but all of the lines detected): enter image description here

0

There are 0 answers