Horizontal Line detection with OpenCV

前端 未结 5 615
一整个雨季
一整个雨季 2020-11-27 12:33

I am trying to find horizontal and vertical lines from an image which came from a \"document\". The documents are scanned pages from contracts and so the lines look like wha

5条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-27 12:55

    If you just want the "lines" and not the "line segments", I would avoid using Canny, Hough, FindContours or any other such function in case you want more speed in your code. If your images are not rotated and what you want to find is always vertical or horizontal, I would just use cv::Sobel (one for vertical, and another for horizontal) and create accumulation arrays for columns and rows. Then you can search for maxima in such accumulations or profiles, for instance by setting a threshold, and you will know the row or column in which there is a vertical or horizontal edge lines.

提交回复
热议问题