A good approach for detecting lines in an image?

后端 未结 5 789
我在风中等你
我在风中等你 2021-01-30 10:59

I\'ve written some code that uses OpenCV libraries to detect white lines painted on grass. I need someone\'s opinion on the approach I used (as I\'m sure there\'s a much better

相关标签:
5条回答
  • 2021-01-30 11:43

    I would try to use a skeleton representation of the image. The problem with your canny, here, is that it basically results in two lines because of the width of the line.

    Then I would apply the Hough transform on it.

    0 讨论(0)
  • 2021-01-30 11:44

    I was using Canny for indoor images, but for outdoor I find more suitable the Laplace filter and Sobel filter, than apply Probabilistic Hough line Transform (PHT).

    If u want to thicker your lines, you should try the Sobel operator after Laplace and finally the PHT. If your image is too nosy it might get worse.

    0 讨论(0)
  • 2021-01-30 11:44

    RANSAC algorithm may be a good method. This method is similar to regression or interpolation approaches. You should extract points after using an edge detection(best method is canny for this goal as I think). Then you should find best line. For finding the line passing through several points there are different methods such as linear regression or RANSAC. You can find implementation and notes about RANSAC algorithm in this link.

    Note that RANSAC and another useful algorithms for this goal are already implemented in OpenCV (as I know in version 3.2) and in Accord NET (a free library for image processing).

    0 讨论(0)
  • 2021-01-30 11:52

    Following your last result (after the skeleton filter), you get many small segments. I think you're in a really good position at that point to implement what's been done in this article:

    http://www.cs.ubc.ca/~lowe/papers/aij87.pdf

    Basically, they provide tools to regroup different features in an image based on how likely they belong to a same object. So all you'd have to do is feed your results to their algorithm and you'd likely get a single line as a result.

    0 讨论(0)
  • 2021-01-30 11:56

    One possible solution is to take all the edge points that you obtain from the canny edge detection and fit a line using linear least sqaures (maybe iterative) on these points. This way you always get a single line that "best fits" the edge points. There is virtually no parametrisation involved with this method.

    0 讨论(0)
提交回复
热议问题