Extract Curves Contours
Hi everyone !
I'm posting this question because, after months, I'm still getting my ease with the library openCV but couldn't reach an automated solution for this curves extraction problem. (also, it's my birthday and finding a solution would be The gift :p )
Don't bother making lines of code; my request is essentially to be tipped in the correct direction.
So, from this sample picture (that some of you might recognize as power/torque graph)
I start quite classic. I pretreated it with bilinear filtering, detected the edges with Canny and then detected contours and houghlinesP. From the last ones, I filtered the outside contour of the graph and every inside contour that was fully included in the houghLines quad.
Then, I simplified all the contours with approxPolyDP and plotted the fitLine to get the tendency of every contour. Here we can see it follows approximately the 4 curves I'm trying to extract.
So the last step here is to clusterize them by hue and display properly the fitted lines.
At this point, there might be some magic involved to help me figure out the curves tendencies and use that to go back to the second image and segment the actual curves from the contours.
But nothing really pops up in my mind and you cannot filter contours properly because points will have messy links in your contours. Though, I just want the pixels of the 4 curves and nothing else.
Thanks for your attention!