Find single color, horizontal spaces in image

前端 未结 1 1479
遥遥无期
遥遥无期 2020-12-06 15:51

For example, there might be a table with text in rows. How could I find all straight, horizontal lines going through the table? E.g. (red lines are the found lines):

相关标签:
1条回答
  • 2020-12-06 16:38

    Just for this question, to detect the horizontal lines, the morph-op is enough.

    import cv2 
    img = cv2.imread("test.jpg")
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    kernel = np.ones((1,100), np.uint8)
    morphed = cv2.morphologyEx(gray, cv2.MORPH_CLOSE, kernel)
    cv2.imshow("res", morphed);cv2.waitKey();cv2.destroyAllWindows()
    


    Update, similar questions:

    (1) Find single color, horizontal spaces in image

    (2) OpenCV/cv2: Removing horizontal underlines

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