How to detect curved lines with openCV
Hello, I am trying to detect curved lines with openCV. I have an image, I apply blur to enhance the contrast and make the lines more visible, then I convert it to gray, and then I apply Canny edge detection. And Until here it works good
From here, i need to identify the three lines. I use HoughTransformP for these purposes.
And I use these parameters: threshold 20, rho 1.7, min Line length 0, max line gap 0
I I use an higher max line gap value, some lines are connected, but also artifacts appears when lines are close.
Does anyone have suggestion about how to proceed?
In my opinion this is already a hard task for a human when following the three lines on the right side. So it is even harder for a computer. Nevertheless the Canny image looks nice and I would have tried to separate the lines after that step using the
findContours
function with the mode CV_RETR_EXTERNAL. Perhaps you can then separate the three contours. Still, the intersection will be a problem.Yes the canny edge detection works really good. I think that I am messing up something when i process the canny edge image and I try to figure out how to merge the two borders, without using any opencv functionality. The image that result from this process is given to the HougTransformP, but it has some "holes". Could you give me some more details to findContours and CV_RETR_EXTERNAL, also links to tutorial or specific documentation are really appreciated. Thanks
Here is a link to the function: https://docs.opencv.org/3.4.1/df/d0d/... I would apply
findContours(Mat CannyImg, vector<vector<Point>> contours, RETR_EXTERNAL, CHAIN_APPROX_NONE)
. The function uses border following (Suzuki, S. and Abe, K., Topological Structural Analysis of Digitized Binary Images by Border Following. CVGIP 30 1, pp 32-46 (1985) which I think will be a problem with the intersecting lines on the right side but perhaps you have some further ideas to handle it :)