Reputation: 77
what OpenCV Python tool would be the best to draw a straight line between multiple 'points' on an image ? Something like a BestFitLine but for thresoldedimage, not a plot
Thanks
processed image (binary threshold)
the black dot are supposed to be each individual crop
what I'd like to have
Upvotes: 0
Views: 1073
Reputation: 952
I'm afraid Hough Lines will fail here. You could try ransac
to get best estimated line, erase those points and run next ransac
. Tough you still can encounter some troubles: exactly how many clusters do you want to recognize? You could set min score sample score for a line model. You'd also need to filter out horizontal lines.
There're ransac
implementations in both scikit-learn and scikit-image.
Upvotes: 1
Reputation: 123
If you haven't tried yet, go with the OpenCV functions HoughLines()
and HoughLinesP()
to detect lines in an image.
Upvotes: 0