1 | initial version |
Depends on what kind of pattern it is - if it's always similar to the one you've showed here (i.e. multiple thin lines), you can try Hough transform - detect all the lines and then just average them. In openCV, detected lines are described with two points, so just average all the first points describing the lines, and then do the same with the second points. Then it's enough to either visualize it or calculate the horizontal angle.
2 | No.2 Revision |
Depends on what kind of pattern it is - if it's always similar to the one you've showed here (i.e. multiple thin lines), you can try Hough transform - detect all the lines and then just average them. In openCV, detected lines are described with two points, so just average all the first points describing the lines, and then do the same with the second points. Then it's enough to either visualize it or calculate the horizontal angle.angle depending on what kind of results you are expecting.